alias for find


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers alias for find
# 1  
Old 01-24-2002
Question alias for find

I've tried to define an alias for the find cmd. I want a find -name and send the error messages to /dev/null. I entered the alias as followed:
# alias myfind 'find $1 -name $2 2>/dev/null'
But it didn't work. Any idea what's wrong with that?
# 2  
Old 01-26-2002
You are probably using the korn shell or some shell similiar to it. They don't have powerful alias commands that can handle stuff like that. You must use functions instead:

myfind() { find $1 -name $2 2>/dev/null ; }
# 3  
Old 01-28-2002
thx, that worked!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

alias ip problem,i canīt find out solution

hi, we have eth1; in the beginning it was proposed to create from eth1, eth1.2500 and eth1.240. It did not worked cause vlan 1.2500 was not tagged in the switch. so they decided to leave eth1 like a physical interface with eth1.2500 config (removel vlan tag) and create eth1.240 but it did... (0 Replies)
Discussion started by: pabloli150
0 Replies

2. UNIX for Dummies Questions & Answers

Create alias files (not alias commands)

If one: $ find -name 'some expression' -type f > newfile and then subsequently wants to create an alias file from each pathname the find command retrieved and the > placed within 'newfile', how would one do this? Ideally, the newly created alias files would all be in one directory. I am... (3 Replies)
Discussion started by: Alexander4444
3 Replies

3. UNIX for Dummies Questions & Answers

Can't find where alias is set

I have an alias set on linux: progs -> /home/user01/prog1.pl the location of prog is changes to /home/user01/new/prog1.pl so I need to modify alias, except I can not find where it is set. It is not in .bashrc or .profile, it is visible by "alias" command. Sorry if it is trivial. (4 Replies)
Discussion started by: analyst
4 Replies

4. UNIX for Dummies Questions & Answers

Find command to exclude directories and setup alias or script?

Hi, Firstly - sorry for the duplicate my other post looked like i was posting a how to for people. But i am wanting some help :P I want to search from / to find files and exclude my mounted ntfs drives. I have found this thread (Which I can't post the URL to until i have 5 posts) it's... (4 Replies)
Discussion started by: mightymouse2045
4 Replies

5. UNIX for Dummies Questions & Answers

Alias help

I can get the nth line of a file using sed -n 'np' file however all I want to type is "line n file" so I am trying to use alias alias line='sed -n \'&\'' but its not working, how can I make this work Thanks (2 Replies)
Discussion started by: chrisjones
2 Replies

6. UNIX for Dummies Questions & Answers

alias

Hi, I have created alias in UNIX environment (ie in .cshrc file). But when i use the alias in the UNIX script, getting an error message as that is not found. But when i use that alias, outside the script it is working fine. Let me know if you need more details For example: alias cderror... (6 Replies)
Discussion started by: Naveen_5960
6 Replies

7. UNIX for Dummies Questions & Answers

alias help

Hi I have a problem when i try to set any thing as alias it works say alias sasa="cd /home/hghgg" but when i close the terminal it does not work (5 Replies)
Discussion started by: shafique
5 Replies

8. Shell Programming and Scripting

Alias

how implement functionality alias in the same way as in csh? (use Bourne type sh or bash) (3 Replies)
Discussion started by: sunhata
3 Replies

9. UNIX for Dummies Questions & Answers

Help with find command on a shortcut directory(Alias)???

Hi All, I am trying to find some files on a directory( /usr/users/xyz/log) which is an alias to another directory(/spare/log). My find works fine on /spare/log but it doesnt return anything when i use it on /usr/users/xyz/log. Any Ideas on how to proceed. Thanks in advance. Swamy (2 Replies)
Discussion started by: swamy455
2 Replies
Login or Register to Ask a Question