Solved

echo commands on a linux script

Posted on 2008-10-18
5
979 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

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 …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

828 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