LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 01-23-2014, 11:18 AM   #1
cbtshare
Member
 
Registered: Jul 2009
Posts: 610

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.

Code:
 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
Quote:
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, 04:31 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 4,110
Blog Entries: 10

Rep: Reputation: 1525Reputation: 1525Reputation: 1525Reputation: 1525Reputation: 1525Reputation: 1525Reputation: 1525Reputation: 1525Reputation: 1525Reputation: 1525Reputation: 1525
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, 05:28 PM   #3
cbtshare
Member
 
Registered: Jul 2009
Posts: 610

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, 06:26 PM   #4
lleb
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?
 
  


Reply


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 06:01 PM
LXer: bash one-liner, Get GPS location and street Address LXer Syndicated Linux News 2 08-05-2010 04:14 PM
paste, cut one liner conversation from bash to csh bioinformatics_guy Linux - Newbie 2 09-02-2009 11: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 02:40 AM
How to turn a file to a one liner thru sh script? jillann Linux - Newbie 15 04-18-2007 10:32 AM


All times are GMT -5. The time now is 06:50 PM.

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