'Make a Bash script echo executed commands
I put together a bunch of alias commands in a folder. Mainly ssh, so instead of having to type...
ssh [user]@[server]
...ten times a day, I can just type...
server
...and the alias script fires. The script is simply the command...
ssh [user]@[server]
This is all working fine, but I was wondering if there was a way in Bash where instead of firing the ssh command quietly, it would display the command that is being executed?
Solution 1:[1]
Put "-x" at the top of your script instead of on the command line:
File server
#!/bin/bash -x
ssh user@server
Execution
./server
results in:
+ ssh user@server
user@server's password: ^C
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Peter Mortensen |
