Questions tagged [mksh]

MirBSD Korn shell, or mksh, is a Free command interpreter (shell) intended for both interactive and shell script use. `mksh` is the default shell on Android, some BSDs and some Embedded Linux distributions, and it is available for most other operating systems. Please use the “ksh” tag for generic Korn Shell questions, and the “mksh” tag (additionally) if your question targets mksh specifically.

Filter by
Sorted by
Tagged with
0 votes
1 answer
49 views

Resetting color in end of PS1 resets commands colors in MirBSD KornShell

I have \033[0m color code in the end of my PS1 prompt for resetting, so what I enter won't be colored. But when I used ls I saw that its colors don't work - everything is white. Same for other ...
0 votes
1 answer
193 views

When does order matter in redirection? [duplicate]

I've written a script that has a few log outs with printf "..." 1>&2 inside a function. Running that script (build.sh) and I've noticed that if I want to redirect stderr to stdout and ...
  • 831
4 votes
3 answers
284 views

What shells support "value substitution" like MirBSD Korn Shell?

On Android (which uses mksh, MirBSD Korn Shell), there's a special syntax of string substitution (called "value substitution"): ${|commands} Instead of collecting output of the commands (as ...
  • 3,132
0 votes
1 answer
512 views

Is it possible to make mksh use the tilde (~) for home in the PS1?

for example, instead of displaying user@hostname:/home/user in the prompt as per the example in the manpage, could one make mksh display user@hostname:~ ?
  • 3
3 votes
3 answers
17k views

How to enable ksh command history between sessions

If I start ksh or mksh, my upwards arrow does nothing: $ ksh $ ^[[A^[[A^[[A^[[A^[[A But it works with bash if I start bash and press the upwards arrow. $ bash developer@1604:~$ ssh root@127.0.1.2 -...
1 vote
2 answers
87 views

Is there a way to localize variables to the current function in `mksh` but not to others?

Is there a way for $val to be set in a () but not be seen by b ()? set -u -e -o pipefail a () { local +x val="myval" echo "in a: VAL= $val" b } b () { echo "in b: VAL= $val" } a Produces: ...
  • 759
5 votes
2 answers
1k views

How do you implement process substitution (using a bash script) in a shell that doesn't have it?

I've seen Fish shell implement process substitution as a function: # === Fish shell lang: function psub mkfifo $the_pipe cat >$the_pipe & echo $the_pipe # remove pipe when bg job ...
  • 759
0 votes
1 answer
873 views

mksh complete when moving to parent directory

I just installed the mksh and don't know how to solve one litte problem I have. When trying to change directory to the parent directory mksh does not complete when pressing "tab". Let me visualize: $ ...
  • 136
2 votes
1 answer
627 views

Is it possible to get working history for multi-line commands in mksh, using vi editing mode?

On my Debian systems, I have always used pdksh as my interactive shell. Originally, command-line history behavior was similar to what I grew up with on platforms like AIX and Solaris. Recently, ...
1 vote
1 answer
1k views

How to make mksh for loop go from 1 to N [duplicate]

So I've tried to do this for x in {1..7000} do echo $x done The output is {1..7000} I've also learned that the C-style for loop doesn't work in mksh I've done a bit of googling but mostly ...
13 votes
4 answers
7k views

Where are zsh and mksh incompatible with bash?

To what extent can other POSIX-compatible shells function as reasonable replacements for bash? They don't need to be true "drop-in" replacements, but close enough to work with most scripts and support ...
  • 821
2 votes
1 answer
2k views

Get the last executed command line in ksh

Is there a way to get the last executed command possibly together with the arguments within a ksh script? I am using mksh with cygwin. I tried fc -nl -1, but the script throws a "“fc: history ...
1 vote
1 answer
1k views

Variable name completion in ksh

While I am in bash , I am able to do a tab complete with environment variable names, but with ksh I am not able to do so. How can I get it done with KSH? I am using mksh with cygwin.