I saw a client doing $bash -x
command to see if the file is executable (or ksh -x
command, etc.) like the -x
in the if
statement in the shell script.
My question is: What does $bash -x
command do?
My interpretation was to start a command in a new bash shell within the current shell, inheriting the same environment variables and executed by the same user.
The funny thing is I can do $ls
but not $bash -x ls
, which give:
(under AIX 6)
/usr/bin/ls: /usr/bin/ls: cannot execute binary file
It is a mystery for me why the error is - guessing it is due to a privilege which means my assumption above is not correct.
Also, I believe $bash ls
and $bash -x ls
is the same thing (-x
for "execute")?
Any comments are greatly appreciated.
Cheers!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…