Matt Mossholder on 23 Dec 2009 04:52:37 -0800

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Easy Bash Scripting Question

On Wed, Dec 23, 2009 at 7:45 AM, Casey Bralla <> wrote:
I've written a bash script and I find that the commands don't normally echo to
the screen, so I can't follow along with the script.

for example:

cp file1 file2
mkdir /directory1
cd /directory1
rm *
cd ..

I'd like to know when the script is copying files, and when it is erasing files.

I could add echo statements, but it would be much simpler if the actual bash
commands simply echoed to the screen.

Is there a simple way to do this?


Add "-x" after your bash command-line at the top of the script. This will make it echo each statement as it is run.

Philadelphia Linux Users Group         --
Announcements -
General Discussion  --