LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-08-2005, 08:42 AM   #1
jfauteux
LQ Newbie
 
Registered: Apr 2005
Posts: 2

Rep: Reputation: 0
alias help


this alias, in my .bashrc works using only one variable

alias dump='sudo -u root /usr/sbin/tcpdump -i eth0 -x -X host $1'

as in dump 172.2.2.2

this one does not using two variables

alias dumptofile='sudo -u root /usr/sbin/tcpdump -i eth0 -x -X host $1 > /home/$2

as in dumptofile 172.2.2.2 filename

error -

-bash /home: is a directory



any ideas why the $2 is ignored?


thanks!
 
Old 04-08-2005, 09:12 AM   #2
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,

1. 'cause you forgot to close the quotes ???
Code:
alias dumptofile='sudo -u root /usr/sbin/tcpdump -i eth0 -x -X host $1 > /home/$2'
2. tip: use something like
Code:
alias dumptofile="sudo -u root /usr/sbin/tcpdump -i eth0 -x -X host "$1" > /home/"$2""
double-quoting also the variables
i think it is better...


regards

slackie1000
 
Old 04-08-2005, 01:29 PM   #3
jfauteux
LQ Newbie
 
Registered: Apr 2005
Posts: 2

Original Poster
Rep: Reputation: 0
hmm - i tried it, same error - and my end quote is there i just missed it on the cut/paste

thanks for the idea tho
 
Old 04-08-2005, 01:56 PM   #4
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,

somehow the parameters are lost after a redirection. ">"
sorry, i didn't know.
can you solve your problem with a function?
file: dumptofile
Code:
#!/bin/sh
echo `sudo -u root /usr/sbin/tcpdump -i eth0 -x -X host $1` > /home/"$2"
in these directions should work...

sorry mate...

regards

slackie1000
 
  


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
Alias question (2 commands for one alias) gflores Linux - Newbie 3 01-21-2006 01:40 AM
ip alias mindcry Linux - Networking 0 10-16-2003 08:41 PM
using alias intruptz Linux - General 5 09-17-2003 05:32 AM
alias booyah Slackware 3 05-06-2003 04:17 PM
alias nobu Slackware 5 01-11-2003 02:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08: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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration