Questions tagged [ksh]

Use the [ksh] tag for questions about the KornShell

19 questions
12
votes
1 answer

What are these auxiliary file descriptors?

While poking around /proc/self folder for my mksh shell, I found a peculiar thing: in /proc/self/fd/* there are all the standard file descriptors (0 for stdin, 1 for stdout, and 2 stderr) some file descriptors, but also some extra ones - 24, 25, 3.…
11
votes
3 answers

Why are numeric function names not allowed?

Consider the following: $ ksh -c '1(){ echo hi;};1' ksh: 1: invalid function name $ dash -c '1(){ echo hi;};1' dash: 1: Syntax error: Bad function name $ bash -c '1(){ echo hi;};1' bash: `1': not a valid identifier bash: 1: command not found $ mksh…
8
votes
3 answers

How do I change to ksh?

I need to learn some ksh details, but i don't want to change from bash to ksh permanently. What should i do? Is it possible to change shell only for a specific console session?
sonnuforevis
  • 1,583
8
votes
5 answers

Why is a blank required between "[[" and "-e xxx" in ksh?

For instance, the following command does not work: if [[-e xyz]]; then echo File exists;fi ksh gives the following error [[-e: command not found Is that because "[[-" is ambiguous?
AcBap
  • 83
2
votes
0 answers

Change directory problem in ksh

I work with Ubuntu 18.04.3 My current directory is /home/hans/bin, The directory /home/hans/.sshz also exist. My shell is "ksh." The command cd ../.ssh give the output. ksh cd: /home/hans/ssh:[No such file or directory] In this command, the .…
1
vote
1 answer

How compatible dash is with ksh?

Can I make /bin/sh symlinked to /bin/ksh instead of /bin/dash without breaking anything in the process ? Since they're both supposed to be POSIX-compliant, can I reasonably expect the replacement to go without issues?
1
vote
0 answers

Login Errors with KSH

My cloud team setup a Ubuntu 16.04 AMI for me in AWS. They have done some items to 'Harden' the instance but they normally use amazon linux and not Ubuntu so I think they have broken some things. Looks like they force the use of the KSH shell which…
Edward S.
  • 111
  • 3
1
vote
1 answer

Default login shell ksh

I want to set the default login shell to the Korn shell (ksh) but chsh doesn't recognize /bin/ksh as a shell. /bin/ksh has been loaded.
0
votes
2 answers

Error in the simple shell script ( i.e.+ : unexpected `end of expression' )?

find_totalusage() { local totalusedsize=0 for dirname in $dirnamelist do dirsize=$(find_dir_size "$dirname") totalusedsize=$(( $totalusedsize + $dirsize )) done echo $totalusedsize } size=$(find_totalusage) Any…
0
votes
1 answer

Where can I find a list of the features from Korn and C shells incorporated by Bash?

I would like to have some documentation about the features from Korn (ksh) and the C (csh) shells incorporated in the Bash command language interpreter. A exhaustive list of commands would be great. Thanks Or is the legacy from the Korn and C shells…
0
votes
1 answer

Difference between bash-shell and ksh-shell by using while with read - what can I do in bash for the same response as in ksh?

I have two scripts: in bash #!/bin/bash H_VARIABLE=empty echo "Zeile1 Zeile2" | while read satz do H_VARIABLE="$H_VARIABLE $satz" done echo H_VARIABLE=$H_VARIABLE Result: H_VARIABLE=empty in ksh #!/usr/bin/ksh H_VARIABLE=leer echo…
0
votes
1 answer

How can I determine the prematch and postmatch using egrep or ksh under linux

I am working on a issue at the office running on a linux system. I would like to be able to either use egrep or ksh pattern matching to determine not only the matched string but I also need to be able to determine the prematch and postmatch…
0
votes
1 answer

Find files modified between 2 dates from Source directory(Recursively) and copy it into the Target directory with same directory structure

I am trying to copy the files from source to Target folder which has been modified between 2 dates, #!/usr/bin/ksh source=/home/Amal/DELTA/SOURCE target=/home/Amal/DELTA/TARGET cd $source find ./ -type f -newermt "2021-07-08 00:00:00" ! -newermt…
Amala
  • 1
0
votes
1 answer

ksh history problem

I'm on Xubuntu 20.04.02 This is a question about ksh command history. Something had changed recently and I'm looking for a way to restore the old behavior. For years and up to about a month or so ago, when you typed a command with an error, it…
0
votes
0 answers

KSH on Ubuntu on WSL

I just installed the Ubuntu app on Windows Subsystem for Linux (WSL). It defaults to a bash shell. I would prefer ksh. I am quite naive when it comes to using package managers to install software. I found this link:…
John
  • 1
1
2