English 中文(简体)
“/bin/sh ls -l -R” v. “bin/sh -c ls -l -R”
原标题:"/bin/sh ls -l -R " vs "/bin/sh -c ls -l -R "

以下两个指挥部在AIX运行时有什么区别?

/bin/sh  ls -l -R 
/bin/sh -c  ls -l -R 
最佳回答

在AIX,/bin/sh对Korn壳(ksh)的违约情况。

/bin/sh  ls -l -R 

用刀切,把手脚指向执行“<条码>l-R(在现行目录或正轨)”的文字。 如果找不到这一名字的文字,就把这一论点作为指挥处理。

请注意,如果无法找到文字,就会产生错误。

/bin/sh -c  ls -l -R 

这开始出现新的壳体,告诉它要管理指挥系统<编码>l-R。

问题回答

(这是针对Phil Ross的,但我需要格式:<>>。

采用我的含水层之一:

sh> /bin/sh --version
GNU bash, version 3.2.39(1)-release (i386-redhat-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.
sh>  /bin/sh  ls -l -R 
/bin/sh: ls -l -R: No such file or directory
sh> /bin/sh ls
/bin/ls: /bin/ls: cannot execute binary file
sh> /bin/sh -c  ls -l | head -1 
total 147296
sh> 

利用我的一个热带风暴装置:

sh> /bin/sh --version
GNU bash, version 3.2.49(23)-release (i686-pc-cygwin)
Copyright (C) 2007 Free Software Foundation, Inc.
sh> /bin/sh  ls -l -R 
/bin/sh: ls -l -R: No such file or directory
sh> /bin/sh ls
/usr/bin/ls: /usr/bin/ls: cannot execute binary file
sh> /bin/sh -c  ls -l | head -1 
total 264744
sh> 

页: 1

  • supplying a filename argument to /bin/sh will interpret it as the filename of a shell script and try to execute it
  • supplying -c with an argument will interpret that argument as a /bin/sh command line and try to execute that

详情,类型

man sh




相关问题
KornShell- Creating a fixed width text file

I need to create a simple fixed width text file in KornShell (ksh). My current attempt using printf to pad the string isn t working out very well. What s the shortest, cleanest way to create a fixed ...

unix find command

how to use the find command to find files/directories which are not matching the pattern. for eg: find <some options > -name "dontfile.txt" should give me output of all the find whose file ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

Case insensitive comparison of strings in shell script

The == operator is used to compare two strings in shell script. However, I want to compare two strings ignoring case, how can it be done? Is there any standard command for this?

1. 露台式照像

在Windows XP中,没有一时出现指挥时,是否有办法操作一种灰色文字? 我常常需要把“善待”(工作)与“灰色”同起来,即使我的文字没有产出,......

热门标签