LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 11-16-2006, 02:15 AM   #1
Primsi
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:

Code:
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 ?

Thx
 
Old 11-16-2006, 02:57 AM   #2
blackhole54
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
Primsi
LQ Newbie
 
Registered: Nov 2006
Posts: 5

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


Reply

Tags
bash, grep, tail, variable



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

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:34 AM.

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