Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-23-2014, 10:18 AM   #1
Registered: Jul 2009
Posts: 619

Rep: Reputation: 42
bash script one liner

I have a need to run a one liner using bash commands to monitor folders.I was wondering if I could get assistance please.

 watch -n 1 -d ls -lt ftp/directory/inbox /home/directory/outbox/ /home/directory/ndm/directory/outbox/transferred/; watch 'folder=$(ls -lt  ftp/directory/processed/ | head -n 8);echo "$folder"'
the issue I am having is the last command is not being displayed in a single session
watch 'folder=$(ls -lt ftp/directory/processed/ | head -n 8);echo "$folder"'
because of the ; sign .But I dont know how to make all show up in one watch session.
Old 01-23-2014, 03:31 PM   #2
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 5,618
Blog Entries: 12

Rep: Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962
I think the only way it can be done is to not have that second watch command and instead to add ftp/directory/processed to your list of directories for the 1 second update and not try to pipe that to head.
Old 01-23-2014, 04:28 PM   #3
Registered: Jul 2009
Posts: 619

Original Poster
Rep: Reputation: 42
yea, but I need to limit the amount of files shown in the output, and that only works by doing it that way.I guess I need to have it in a script then to work and just watch the script.
Old 01-23-2014, 05:26 PM   #4
Senior Member
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
or run split screen and run each watch command in a separate screen?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] bash script problem -- pass complex *one-liner* to a variable RandyTech Linux - Newbie 12 01-27-2013 05:01 PM
LXer: bash one-liner, Get GPS location and street Address LXer Syndicated Linux News 2 08-05-2010 03:14 PM
paste, cut one liner conversation from bash to csh bioinformatics_guy Linux - Newbie 2 09-02-2009 10:36 AM
LXer: Bash One-Liner Script To Produce Somewhat-Fancy Output Of Who's On Your Linux O LXer Syndicated Linux News 0 11-19-2008 01:40 AM
How to turn a file to a one liner thru sh script? jillann Linux - Newbie 15 04-18-2007 09:32 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:20 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration