csh -> ksh conversion question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting csh -> ksh conversion question
# 1  
Old 05-16-2006
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 \!* -print"

Thanks,

Jonny.
# 2  
Old 05-16-2006
alias ll="ls -l"

Korn has built in PWD.
Here is some common stuff I put in my korn profile. PWD works nice and so does indivdual root history.


#alias settings
alias ll="ls -l"
alias rm="rm -i"
#Set command line like vi
set -o vi
LOGNAME=$(logname)
#Set prompt
export PS1=[root@$(hostname)]'$PWD>'
#Set history file for each user
HISTFILE=".`logname`_history"
export HISTFILE
DATE=$(date)
echo "Login at $DATE" >> $HISTFILE
#Set roots path for security
PATH="/usr/sbin:/usr/bin:/bin:/usr/local/bin"
#Set backspace
stty erase ^H
# 3  
Old 05-17-2006
Thanks - my general set up is OK, getting an equivalent way of placing arguments within an alias string is giving me a problem. I think I will need to convert these type of aliases to functions.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Different epoch conversion result for bash and csh users

Hi there I'm using this script to convert command line history with Epoch time stamp to human readable. While it works fine with users with /bin/csh shell, it fails to convert for users with /bin/bash shell. Why is this happening? I even changed and added * and after the # but it still didnt... (2 Replies)
Discussion started by: hedkandi
2 Replies

2. 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

3. 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

4. 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

5. Shell Programming and Scripting

Perl in KSH - julian conversion

Hello Everyone, I have this code misbehaving in one of my scripts, I have a var containing the sequential number of the day for the year and I am suppose to get the regular date for that day and its weekday. If I set the day to 273 I get back 2008/09/31 which is not a proper date. can you help... (7 Replies)
Discussion started by: gio001
7 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. Shell Programming and Scripting

Conversion question about ksh

Hi all, New to ksh and had a few questions to see if this is doable in ksh or if I am going to have to call out to a tcl procedure. I have an Ascii file I want to convert to hex then search and remove all hex chars '0A' and then convert back to Ascii. Here is an example of an Ascii file I am... (2 Replies)
Discussion started by: hgjdv
2 Replies

8. 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

9. Shell Programming and Scripting

\!* 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:... (3 Replies)
Discussion started by: timsk
3 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