Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 11-16-2006, 02:15 AM   #1
LQ Newbie
Registered: Nov 2006
Posts: 5

Rep: Reputation: 0
Bash: Script with tail and grep

I would like to make a script to check my maillog and I tried the following:

su -c 'tail -f /var/log/maillog | grep $1'
this doesn't seem to work. How can I pass the variable for grep to the script ?

Old 11-16-2006, 02:57 AM   #2
Senior Member
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Use double quotes instead of single quotes around your command.
Old 11-16-2006, 05:30 AM   #3
LQ Newbie
Registered: Nov 2006
Posts: 5

Original Poster
Rep: Reputation: 0
Works perfectly, thanks a lot.


bash, grep, tail, variable

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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird tail + grep bug Aeiri Linux - Software 2 12-15-2006 05:30 AM
bash script with grep and sed: sed getting filenames from grep odysseus.lost Programming 1 07-17-2006 11:36 AM
Bash script question (grep and awk) hamish Linux - Software 6 04-06-2005 03:14 PM
bash script and grep syros Programming 4 01-13-2005 03:04 PM
Help pls!!! grep or tail->restart poj Linux - Software 3 11-26-2004 12:50 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:45 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