Questions tagged [ksh]
The Korn shell (ksh) is a shell with advanced scripting features, commonly found on commercial unices and some BSD systems but rarely used on Linux.
830 questions
8votes
1answer
239views
bash or ksh 'vi' mode - How to jump to end of history (most recent command)?
I am a long time ksh user, and use bash under duress - both in 'vi' editing mode. One thing that has always niggled - after searching back through history for a command (.e.g <Esc>/needle), how ...
-1votes
1answer
62views
"history -0" works in ksh, why doesn't "history -0" work in zsh?
Why does ksh history -0 (last command which is the history command itself) work, yet zsh it fails (only history -1 avail on my zsh). I tried zsh -f to use default options and it still fails. I'm ...
0votes
1answer
44views
ksh: how to capture the current invoked command and arguments?
How do I obtain a variable with the current command and arguments? I would like to use escape code to print this in an Xterm title bar. I see Terminal.app on MacOS is determining the name of the ...
3votes
1answer
202views
zsh: History is skipping commands and integers+, how to correct this?
Does anyone know what's occurring with zsh below and how to get the same behavior I show with ksh and bash? I'm noticing zsh on MacOS v13.7 is skipping even commands numbers in its history output, ...
0votes
0answers
22views
Shell: redirecting output to /dev/tty and another file in a script? Not having to retype ending?
How do I accomplish this command to redirect command output to multiple files, without retyping the later A=1>&/dev/tty 1>&${TMP}/lastcmdout every time? I want to see output on the ...
0votes
0answers
33views
Can't use combination of parentheses and variables in scripts [duplicate]
I have problems with replacing parentheses in combination with variables, in ssh. For instance, replacing (hello123blablabla) with (hello). So, it replaces all together, and parentheses as well, at ...
-4votes
1answer
58views
how to check if a large script is only using full paths for the used cmd inside it?
to make a script more secure, we would need to confirm that used cmds, eg.: "/usr/bin/chown" instead of just "chown".
1vote
1answer
17views
Running a command before running user input in ksh
I'm running Korn 93u+ and I want to echo the current time each time I enter a command. I currently just put the time in my PS1, but that's obviously flawed because if I leave the command line for some ...
0votes
1answer
34views
xutils.sh in open sourced CDE?
I am reading a book about dtksh. The first "hello world" example begins as follows: #!/usr/local/dt/bin/dtksh . $UTILDIR/xutil.sh XUinitialize TOPLEVEL Hello "$@" XUlabel LABEL $...
5votes
1answer
303views
How to determine what is opening tmp files when I invoke a subshell with ksh
I'm experiencing extremely sluggishness in opening subshells (by using ` ` or $( ) command substitutions in scripts) while in ksh on some Linux servers. The same problem does not exist in sh or any ...
3votes
2answers
100views
Simulated Execution of Redirections
My shell is the Korn Shell, but I think the problem (and its eventual remedy) applies to other shells as well. I usually build a "simulation mode" into my scripts to test potentially ...
1vote
1answer
231views
Unknown file called 1
I regularly have a file created without wanting to do so. It is not traced by git in my project. It's just called 1 and contains only true What should I check to know what causes this file to be ...
0votes
1answer
88views
Cut command failing
We have a ksh Script that is suppose to give the output as last day of the month but when ever we run it we get the below error: cut: fields are numbered from 1 Try ‘cut —help’ for more information, ...
0votes
3answers
203views
Find command slow when I'm not piping into awk
I have a script I've used for many years for building a list to some directories, with the following lines: ##Find all scenarios for this sector number find /gsgt/source/scenarios/AT_* -name ${...
1vote
1answer
77views
ksh: How to execute command before user input is executed?
I want to update the window title to the name of the command currently being executed in a terminal running ksh. In bash I could use a special signal trap trap __update_title DEBUG In zsh I could use ...