Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 984
  • Last Modified:

echo commands on a linux script

Hi,

I'm writing a script on Linux Fedora, I would like it to echo the commands it is executing.

Any way to do this ?

Thanks,

siranm
0
siranm
Asked:
siranm
  • 2
  • 2
1 Solution
 
jgiordanoCommented:
you could redirect the output but that won't tell you what it is currently executing.

If you want to see the actual command or steps; before each command put, so you know where the script is:

echo "Currently executing command1"
command1


echo "Currently executing command2"
command2
0
 
siranmAuthor Commented:
Thanks, that's what i'm actually doing...

But I want to do it like an MS DOS batch, that you can actually see the commands executing....
0
 
omarfaridCommented:
you could also run it as

bash -x scriptname
0
 
omarfaridCommented:
Also, you may put

#!/usr/bin/bash
set -x

at the script beginning
0
 
siranmAuthor Commented:
i'll give it a try, it seems to work, thanks !
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now