我从 - http://www.thegeekstuff.com/2010/06/bash-conditional-expression/ 那里得到了一个脚本
是-
$ cat exist.sh
#! /bin/bash
file=$1
if [ -e $file ]
then
echo -e "File $file exists"
else
echo -e "File $file doesnt exists"
fi
$ ./exist.sh /usr/bin/boot.ini
File /usr/bin/boot.ini exists
我在 echo 附近使用了相同的代码,但没有 -e 并且它可以工作。那么,使用 -e 的目的是什么?
最佳答案
-e
标志可以解释以下反斜杠转义的内容
每个字符串中的字符:
\a alert (bell)
\b backspace
\c suppress trailing newline
\e escape
\f form feed
\n new line
\r carriage return
\t horizontal tab
\v vertical tab
\\ backslash
\NNN
the character whose ASCII code is NNN (octal); if NNN is not
a valid octal number, it is printed literally.
\xnnn
the character whose ASCII code is the hexadecimal value
nnn (one to three digits)
关于linux - 该脚本中 -e 标志的用途是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18002282/