LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 10:18 AM   #1
cbtshare
Member
 
Registered: Jul 2009
Posts: 645

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, 03:31 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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
cbtshare
Member
 
Registered: Jul 2009
Posts: 645

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
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

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


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:53 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
Open Source Consulting | Domain Registration