\!* in csh what is it for ksh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting \!* in csh what is it for ksh
# 1  
Old 06-07-2005
\!* in csh what is it for ksh

Hey guys,
Hopefully a simple question for you.

In csh I have an alias that looks like:
alias ff 'find . -name \!* -print'
and can therefore perform a search for a file by typing:
ff filename

The same comand does not work in ksh
alias ff="find . -name \!* -print"
I get:
find: 0652-009 There is a missing conjunction

Any ideas what the ksh equivalent is ?

Thanks

timsk
# 2  
Old 06-08-2005
In your csh alias, you are using !*. !* has some significance in csh as the following quote from 'man csh':

Quote:
Word Designators
A `:' (colon) separates the event specification from the word designator. It can be omitted if the word designator begins with a ^, $, *, - or %.
Word designators include:
.
.
* All the arguments, or a null value if there is just one word in the event.
.
.
So the !* that is sent in to the ff alias feeds the -name option with the required arguments. You need to check how to do this in ksh.
# 3  
Old 06-08-2005
According to my AIX documentation "alias" as a ksh built-in command is working exactly the same way as "/usr/bin/alias" and does string substitution only. That is "alias foo=bar" will replace any occurrence of "foo" to "bar" in your input string (=command) , but will not expand any variables.

I suppose (since you are coming from a csh environment) you do not have AIX (do you?) so I'm only left to guesses what your system may support, but suppose it doesn't do such a thing.

Then the thing you *can* do is: define a function in your .kshrc:

Code:
# cat ~/.kshrc
...
ff ()
{
     find . -name "$1" -print
}
...

This will work the same way as your alias, save for you will have to "unset" it instead of "unalias" it if you want to restore the original behaviour of "ff" (whatever that may be).

Hope this helps.

bakunin
# 4  
Old 06-08-2005
As a function .... that looks good. Yes I am on AIX. Thank you Bukunin

Tim
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Translate csh to ksh

Hi! I need to translate those line in csh (to initialise variable) into ksh construct. Any help would be appreciated! I don't know how to replace them :( Thanks Hulu setenv TestHul "$0 $*" setenv JG `setenvp "JG" "" "$*"` setenv A_1 `setenvp "A_1" "NA" "$*"` Please use next time... (2 Replies)
Discussion started by: patator67
2 Replies

2. Shell Programming and Scripting

ksh equivalent to >& in csh

In csh I am using >&. What is the equivalent in ksh?? >& - redirect stdout and stderr (csh,tcsh) (18 Replies)
Discussion started by: kristinu
18 Replies

3. Shell Programming and Scripting

csh has function -x as ksh ?

Dear All, Normally, I use ksh to code script but I got a new assignment to check the error code of csh so I want to know csh has fuction -x(/bin/ksh -x) as ksh or not? If csh has, which mode? Another way, how can I check it my code is correctly? Thank in advance (2 Replies)
Discussion started by: unitipon
2 Replies

4. Shell Programming and Scripting

calling csh script from ksh shell

hi, I have a csh script, which has setenv X xyz etc My shell is korn Is there some way I can "source" this to have the variables in my current korn shell? thanks (3 Replies)
Discussion started by: JamesByars
3 Replies

5. Shell Programming and Scripting

How to define array in Bourne shell , csh & ksh

Dear friends... Kindly if any one can help me to know the differences in definning & retreiving data from arrays in the sh,csh & ksh. I always facing problems in this issue. thanks...:) BR (3 Replies)
Discussion started by: ahmad.diab
3 Replies

6. Shell Programming and Scripting

how to run ksh from csh

I'm comfortable with csh. However, i need to run a ksh script.Using exec /bin/ksh -i , I'm able to invoke ksh, but the script is not running any further. Variable QDDTS is an env setting on my csh env. The ksh script goes like this - #!/bin/csh exec /usr/local/bin/ksh -i function... (3 Replies)
Discussion started by: m_shamik
3 Replies

7. UNIX for Dummies Questions & Answers

Csh Vs Ksh

I created a simple script and attempted to run it. All that the scrip contained was "ls -l". At first I received the message "ksh: run_dir: not found" I then tried typing "csh run_dir" This time the script worked. typing echo $SHELL produced /bin/ksh I would like to understand why this... (4 Replies)
Discussion started by: SUSANR9999
4 Replies

8. Shell Programming and Scripting

Exactly How can we define "sh ksh csh &bash"

Hi - I m prashant. I m new in UNIX&LINUX world. I want to ask that how can we define the shell in Linux like bash,ksh,csh in Linux. What is the use of these shells. I know there are mny experts on net if you can tell me then please do me this favour and tell me about this topic. ... (1 Reply)
Discussion started by: prashantsingh
1 Replies

9. Shell Programming and Scripting

csh -> ksh conversion question

Having been a long-time csh person I now need to convert a lot of stuff to run under ksh. Can anyone tell me how to do a ksh equivalent of the csh history substitution !* that can be used in an alias, ie how would I do: alias cd "cd \!*; pwd" alias find "find . -name... (2 Replies)
Discussion started by: jonnywilkins
2 Replies

10. UNIX for Dummies Questions & Answers

switch from csh to ksh

My UNIX SA requires that we start in CSH. I like to use KSH because most of my experience is in that shell. I added ksh to the end of my .login script which does take me into KSH but I would like to automatically execute my .profile to setup my aliases. I cannot use a .shell file because I... (1 Reply)
Discussion started by: veeracer
1 Replies
Login or Register to Ask a Question