Solved

echo commands on a linux script

Posted on 2008-10-18
5
978 Views
Last Modified: 2013-12-16
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
Comment
Question by:siranm
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:jgiordano
ID: 22750618
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
 
LVL 3

Author Comment

by:siranm
ID: 22750673
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
 
LVL 40

Accepted Solution

by:
omarfarid earned 125 total points
ID: 22750675
you could also run it as

bash -x scriptname
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 22750683
Also, you may put

#!/usr/bin/bash
set -x

at the script beginning
0
 
LVL 3

Author Closing Comment

by:siranm
ID: 31507504
i'll give it a try, it seems to work, thanks !
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question