Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set an alias on Ubuntu?

Status
Not open for further replies.

lcs01

Programmer
Aug 2, 2006
182
US
I remembered that when I was using Solaris, I could create an alias like this:

Code:
% alias mygrep 'grep \!* myfile.txt'

I understand that I should use '=' while creating an alias on Ubuntu, e.g.

Code:
% alias ll='ls -l'

However, I don't understand why the following alias would not work:

Code:
% alias mygrep='grep \!* myfile.txt'

Could someone help? Many thanks!
 
Thanks for your following up.

BTW, I am using bash.

Here are the squences (My linux prompt is "[{$process#}] =>"):

Code:
[1108] => [b]alias mygrep[/b]
alias mygrep='grep \!* myfile.txt'

[1109] => [b]cat myfile.txt[/b]
This is a test.
This is a test.
This is a test.
This is a test.

[1110] => [b]grep isis myfile.txt[/b] // Nothing is returned, which is supposed to be

[1111] => [b]mygrep isis[/b]
myfile.txt:1:This is a test.
myfile.txt:2:This is a test.
myfile.txt:3:This is a test.
myfile.txt:4:This is a test.
grep: isis: No such file or directory

[1112] => [b]grep is myfile.txt[/b] // All lines are returned, which is also expected
1:This is a test.
2:This is a test.
3:This is a test.
4:This is a test.

[1113] => [b]mygrep is[/b]
myfile.txt:1:This is a test.
myfile.txt:2:This is a test.
myfile.txt:3:This is a test.
myfile.txt:4:This is a test.
grep: is: No such file or directory
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top