2017-03-02 100 views
0

我對腳本Googliser和Mac命令有疑問。在Mac中使用Googliser.sh搜索圖像:「ls:illegal option - I」

我幾天前在Mac shell中嘗試了這個腳本,並使其工作。我按照上面列出的腳本here

brew install wget 
brew install gnu-getopt 
brew link --force gnu-getopt 
curl -sO https://raw.githubusercontent.com/teracow/googliser/master/googliser.sh 
sed -i "" "s/readlink/stat/;s/dev\/shm/tmp/;s/p -p/p -t/" googliser.sh 
chmod +x googliser.sh 

很簡單。它的工作,不是第一次,我不記得我是如何工作的。但是,然後,我做了我的魔力,並停止工作。

該問題與gnu終端和達爾文終端中命令的差異有關。達爾文不允許使用ln --I,但在劇本中使用它。

所以每次我嘗試運行該腳本,我得到:

usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...] 
ls: illegal option -- I 
usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...] 
ls: illegal option -- I 
usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...] 
     0/10 result groups downloaded. ls: illegal option -- I 
usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...] 
ls: illegal option -- I 
usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...] 
ls: illegal option -- I 
usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...] 
sed: 1: "/youtube/Id;/vimeo/Id;s ...": invalid command code I 
No results! 

我不想放棄,因爲它的工作。我試圖修復它安裝coreutils和其他軟件包以獲得gnu命令,但沒有成功。可能它與.bash_profile文件有關,現在它是空的。如果我要求brew list它是我安裝了這個。現在很少的東西,再重新安裝了一切:

gettext  montage 
gnu-getopt openssl  wget 

我失去了一些東西-sure我,很多東西 - 。但是,有人知道爲什麼會發生這種情況?

N.

回答

0

好了,這裏回答:https://gist.github.com/dardo82/567eac882b678badfd097bae501b64e2/

#!/bin/sh 

brew install  wget 
brew install  ghostscript 
brew install  coreutils 
brew install  gnu-sed 
brew install  gnu-getopt 
brew link --force gnu-getopt 

curl -O https://raw.githubusercontent.com/teracow/googliser\ 
\/master/googliser.sh 

sed -i "" "s/readlink/greadlink/;\ 
     s/mktemp/gmktemp/;\ 
     s/head/ghead/;\ 
     s/ sed/gsed /g;\ 
     s/(du /(gdu /;\ 
     s/(ls /(gls /g;\ 
     s/dev\/shm/tmp/"\ 
    googliser.sh 
chmod +x googliser.sh 

和它的作品。

N.