-d命令在shell脚本中使用命令解压缩

时间:2014-02-05 12:05:41

标签: shell

我使用以下命令解压缩文件

unzip“/cygdrive/c/auto/-"$new"-test.zip”-d“/ cygdrive / c / auto /”

只想知道使用-d“/ cygdrive / c / auto /”

-d在这做什么  我搜索了很多网页,但发现它解压缩了文件。

2 个答案:

答案 0 :(得分:1)

来自man unzip

[-d exdir]
          An optional directory to which to extract  files.   By  default,
          all files and subdirectories are recreated in the current direc-
          tory; the -d option allows extraction in an arbitrary  directory
          (always  assuming one has permission to write to the directory).
          This option need not appear at the end of the command  line;  it
          is also accepted before the zipfile specification (with the nor-
          mal options), immediately after the  zipfile  specification,  or
          between the file(s) and the -x option.  The option and directory
          may be concatenated without any white space  between  them,  but
          note that this may cause normal shell behavior to be suppressed.
          In particular, ``-d ~'' (tilde) is expanded  by  Unix  C  shells
          into  the  name  of  the  user's  home directory, but ``-d~'' is
          treated as a literal subdirectory ``~'' of  the  current  direc-
          tory.

答案 1 :(得分:0)

-d是您的目标目录

下次,您可以在ssh中使用“man unzip”。