Skip to main content

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.

Filter by
Sorted by
Tagged with
1 vote
2 answers
128 views

In bash I can use local -n ref_name=$1 to pass an argument to a function by reference, but the same syntax in ksh throws an error saying typeset: -n: unknown option I tried nameref ref_name=$1 ...
Harry's user avatar
  • 239
1 vote
1 answer
80 views

I have the below shell script which works fine in Bash to list all the directories residing inside a given directory path and add them to an array. But the same script code doesn't work in KornShell. ...
Harry's user avatar
  • 239
8 votes
1 answer
317 views

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 ...
Annihilannic's user avatar
0 votes
1 answer
70 views

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 ...
atod's user avatar
  • 155
0 votes
0 answers
52 views

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 ...
Nick's user avatar
  • 205
-5 votes
1 answer
78 views

to make a script more secure, we would need to confirm that used cmds, eg.: "/usr/bin/chown" instead of just "chown".
robert8819's user avatar
0 votes
1 answer
63 views

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 $...
M.E.'s user avatar
  • 631
3 votes
2 answers
121 views

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 ...
bakunin's user avatar
  • 793
0 votes
0 answers
63 views

File name: /u02/app/scmdw/scr/appcheck1.sql Shell script: test.ksh #!/bin/ksh line=`sqlplus $SCMDWSA @/u02/app/scmdw/scr/appcheck.sql` echo "== Result of SQL: line = $line" When I try to ...
Celestica - Prabhahar Palanive's user avatar
0 votes
3 answers
241 views

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 ${...
atc_ceedee's user avatar
0 votes
0 answers
86 views

I have a storage.src file with the following 2 environmental variables exported export FIRST="HelloHelloHello" export SECOND="World" I have a .sh file as follows #!/bin/ksh . /...
Devansh Mittal's user avatar
0 votes
1 answer
136 views

I have inherited shell scripts that have a bash shebang...but for some reason have a .ksh extension. The creator of these scripts is no longer here and I cant find any reason in Google. Why would he ...
Tim Boland's user avatar
-2 votes
1 answer
181 views

I want a variable, let’s say PS, defined in my .profile file with the following value: PS1='PWD: ${PWD} $ ' So that when I enter $PS in my terminal, I get a two-lined prompt string, the first line ...
Mr. Man's user avatar
3 votes
1 answer
115 views

I wrote a ksh function for git checkout (I've removed some irrelevant proprietary components for the sake of the public question, if you're wondering why it's useful to me): # Checkout quicker ...
Yehuda's user avatar
  • 351
0 votes
1 answer
116 views

tl;dr how can I substitute a string (i.e. a youtube/streaming url) in an alias such as alias mpvyt='yt-dlp <URL> -o - | mpv - ' ? I live in a mezzanine studio using a M1 macbook for a ...
sylvansab's user avatar
  • 109
0 votes
0 answers
30 views

I have this code: if (( i == 0 )); then findCommand="find . -name \"${id}*0${month}*\" | sort -r | head -1" else findCommand="find . -...
const314159's user avatar
-2 votes
1 answer
286 views

The below "for" loop works locally on the same server. But when triggered through "ssh" protocol on remote servers, the output is not received. Please, can anyone suggest how to ...
ShyamNarayan's user avatar
0 votes
1 answer
119 views

KornShell pattern extends POSIX shell "glob" patterns (i.e. *, ?, etc.) with repetition specifiers such as *(...), +(...), as well as negation among many nice features. In a hobbist project, ...
DannyNiu's user avatar
  • 722
2 votes
1 answer
528 views

The following code works on Zsh 5.8 that I tried, despite the missing semicolon. But is it really a valid Zsh syntax? #!/bin/zsh if var='value' then echo 'then' fi Without an assignation that ...
Olivier Pirson's user avatar
1 vote
1 answer
311 views

I am attempting to install sodium native as an npm package on OpenBSD 7.3 amd64. Aside: As a dependency of Hypercore, Hyperbee and Corestore. This needs node-gyp. Following this, I set the C and C++ ...
Lee's user avatar
  • 549
0 votes
0 answers
241 views

I am using below command and it works: uuencode stats.txt stats.txt | mailx -s "users" [email protected] But when I put same command inside my shell script, it does not work. I dont have email. ...
Drsin's user avatar
  • 1
1 vote
1 answer
83 views

I have an alias rm='/bin/rm -i' and I know that if I type "rm" filename in the command line, the alias will be ignored somehow and the normal rm command without the -i flag will be called, ...
BrassPandaSax's user avatar
0 votes
1 answer
195 views

I'm writting a scsript to automate some check at work & i have trouble on only 1 standing issue which is the script never ending. It do the all task over & over. There are 2 while loop & ...
shuratenko's user avatar
49 votes
1 answer
14k views

We've seen a few posts here lately that use this: var=$(</dev/stdin) in an attempt to read the shell's standard input into a variable. That is however not the correct way to do it on Linux-based ...
Stéphane Chazelas's user avatar
-3 votes
1 answer
476 views

Below works fine: awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$57,$9,$55,$10,$11,$12,$56,$13,$53,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,...
Ami's user avatar
  • 1

1
2 3 4 5
17