Is there a way to run Linux command after the # operator for example:
testuser$ ls # pwd
To chain multiple commands?
Is there a way to run Linux command after the # operator for example:
testuser$ ls # pwd
To chain multiple commands?
In bash you can split multiple commands in a few ways:
cmd1
and cmd2
unconditionally one after another you can use the semicolon: cmd1; cmd2
cmd2
only if cmd1
succeeds you can use double-and: cmd1 && cmd2
In your case I assume what you wanted to do is simply ls; pwd
On the linux system, the pound symbol is used to comment text. You might want to try using &&. Example:
ls && ls -lah
This would list files and wait for the ls command to finish before running ls again with different switches. Stated another way:
&&