2017-03-02 98 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.