Mailinglist Archive: opensuse (2496 mails)
| < Previous | Next > |
Re: [opensuse] .bashrc alias - One Liner Problem?
- From: "David C. Rankin" <drankinatty@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 01 Dec 2008 13:23:19 -0600
- Message-id: <493439A7.1020904@xxxxxxxxxxxxxxxxxx>
Anders Johansson wrote:
Kulkis
Thanks Anders,
Lucky was the operative word. I will find whatever howto suggested this
in the
first place and convey the information. I think I still have the link
somewhere. Further experimentation shows, as always, you are dead-on:
alias tstinput='echo -e "\ntest\n\$2=$2; \n\$1=$1; \n\$3=$3\n"'
. .bashrc
13:19 alchemy~> tstinput one two three
test
$2=;
$1=;
$3=
one two three
Mystery solved.
--
David C. Rankin, J.D.,P.E. | openSoftware und SystemEntwicklung
Rankin Law Firm, PLLC | Countdown for openSuSE 11.1
www.rankinlawfirm.com | http://counter.opensuse.org/11.1/small
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
On Monday 01 December 2008 19:12:24 David C. Rankin wrote:
I finally resolved to the function idea Aaron first suggested.
Who is Aaron?
Kulkis
This is pointless. "wp konqueror" expands to
wpsearch $1 konqueror
and the only reason your alias works is that this is a valid string, since $1
is the empty string after expansion. But try starting this from a script
where
you pass parameters. Then $1 won't be empty, and then you will get weird
results
I guess I've been lucky using $1 with aliases. I don't know how they
work,
but they work in most instances for me:
alias hist='history | grep $1' #Requires one input
Same thing for all of these. "hist konqueror" expands to
history | grep $1 konqueror
which works because $1 is the empty string. tmsg -f expands to
sudo tail $1 -n 50 /var/log/messages -f
which again is a valid command line
And so on and so on and so forth
Anders
Thanks Anders,
Lucky was the operative word. I will find whatever howto suggested this
in the
first place and convey the information. I think I still have the link
somewhere. Further experimentation shows, as always, you are dead-on:
alias tstinput='echo -e "\ntest\n\$2=$2; \n\$1=$1; \n\$3=$3\n"'
. .bashrc
13:19 alchemy~> tstinput one two three
test
$2=;
$1=;
$3=
one two three
Mystery solved.
--
David C. Rankin, J.D.,P.E. | openSoftware und SystemEntwicklung
Rankin Law Firm, PLLC | Countdown for openSuSE 11.1
www.rankinlawfirm.com | http://counter.opensuse.org/11.1/small
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
| < Previous | Next > |