Need a better find for csh

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need a better find for csh
# 1  
Old 12-04-2007
Need a better find for csh

At /home/me/bin I've got a script called fg. The meat of it is:

find . -name "$1" | xargs grep $2

The intent is to call it as "fg file_pattern search_pattern" and search all matching files. I've added the directory to my path and made the file executable, but when I try to use it I get

fg: no such job

Any help would be greatly appreciated!
# 2  
Old 12-04-2007
Hi James,

fg is a command to restart suspended process or job.

instead, why dont you give execute permissions to the script
(eg. chmod 755 fg)

and then execute the scripts by saying

./fg file_pattern search_pattern

This should work

lemme know
# 3  
Old 12-04-2007

or best rename the script (fg) to something else
# 4  
Old 12-04-2007
Renaming it worked. But now grep is not giving the path to the fine. Any ideas?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

What does this do in CSH?

CSH experts What does the following do in CSH? :(){:|:&};: I was asked the question, but I don't know. I'm not aware of the context. Any ideas? Thanks! (1 Reply)
Discussion started by: wallg
1 Replies

2. Shell Programming and Scripting

.sh to .csh

Hi All, Could any one of you give me a hand to convert the following line of codes from .sh to .csh please ? proc_id=`fuser /tmp/test` if then echo "File is not being used by any thing" fi if then echo "File is being used... please wait" sleep 1 fi Regards. (1 Reply)
Discussion started by: sraj142
1 Replies

3. Shell Programming and Scripting

csh script help

Hey I am brand new to this forum and scripting. I have several documents (1000+) all formated exactly the same. Each document contains 97 lines. I want to pull 3 lines from the documents to populate a file. These 3 lines are line number 9, 24, and 58. Ok my questions: Instead of using... (3 Replies)
Discussion started by: david6789
3 Replies

4. Shell Programming and Scripting

Using \n in csh

I am trying to use \n for a new line in csh like this echo "some text\n" echo "some more text\n" but am getting some text\n some more text\n (10 Replies)
Discussion started by: kristinu
10 Replies

5. Shell Programming and Scripting

if in csh

I am using this code echo "opt_tpath = $opt_tpath" if ($opt_tpath == 1) echo " -tpath = $Atpath\n" and is giving opt_tpath = 0 Atpath: Undefined variable. Atpath should only be printed in opt_tpath == 1 but it still tries to print. ---------- Post updated at 10:05 AM ----------... (1 Reply)
Discussion started by: kristinu
1 Replies

6. Shell Programming and Scripting

which CMD in csh

Today I encounter one problem, I ran one script like follows: #!/bin/csh -f which ls It supposes to skip the .cshrc and .login files when run this script with the "-f" option, but it does NOT. I can see the "which" cmd first source the .cshrc ( I marked one "echo " in .cshrc ), then... (3 Replies)
Discussion started by: tpltp
3 Replies

7. UNIX for Dummies Questions & Answers


what is a .csh extension? there is a command line: mkaphed_ctio.csh Does anyone know what this is? :confused::confused::confused: (1 Reply)
Discussion started by: cosmologist
1 Replies

8. Shell Programming and Scripting

Find Existence of File with wild card using Csh

Hi All, I would like to find out the existence of files with wild card using CSH. I have used the below code but does not seem to work. Can any expert give me some advice ? set nonomatch set pattern = "_xxx" set filetype = ( *$pattern* ) if ( -e $filetype) then echo... (2 Replies)
Discussion started by: Raynon
2 Replies

9. Shell Programming and Scripting

csh array help!!

I'm trying call the first item in the array then put it in a loop to call the next items in order. set $p = (port-1, port-2, port-3, port-4, exit) <sourcePort>daughtercard:$P</sourcePort> if ($p == "exit") then break else ($p >> 1) I know the above code isn't correct. I'm... (1 Reply)
Discussion started by: drkelly76
1 Replies

10. Shell Programming and Scripting

csh failing to call an 2 embedded csh script

I have an extraordinary problem with a csh script.....(feel free to berate the use of this but I'm modifying an existing bunch of them) Anyway, I have a master csh script which in turn calls a second csh script. This second csh script is below. Within this second script are two compiled C++... (1 Reply)
Discussion started by: pollsizer
1 Replies
Login or Register to Ask a Question