Solved

echo commands on a linux script

Posted on 2008-10-18
5
982 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
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.

688 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