Which shell do you use?

Tcsh for all my accounts, the standard bourne sh for scripting and if things get complicated perl.
 
I use tcsh because I like the programmable completion and the completion.
For scripting I use sh and Python.
 
Hmm, not many ksh users out there, it seems. After spending my early years with csh and tcsh, I switched about 20 years ago to ksh, as I could have the same shell on Windows (with MKS Toolkit), and I haven't switched since.

I use pdksh, as none of the ksh93 features seem compelling to me, and I figure that for sure I'd have to relearn something. :)

The big thing that I love about ksh in general is "set -o vi" which lets me use the navigation keys that are ingrained in body ... navigation without having to think about it, and without having to locate the cursor keys on the keyboard. And note that it also supports "set -o emacs" so there is no need to have a religious discussion about vi vs emacs! :e
 
tomh009 said:
The big thing that I love about ksh in general is "set -o vi" which lets me use the navigation keys that are ingrained in body ...

I can't tell you how many MSWord documents that have :w or :wq embedded randomly within... it's tough to break.
 
I recognize those random letters from my documents, too! That's why I try to have as many common tools across platforms as possible, and ksh and vi are an easy choice for that.
 
I'm using tcsh, because the history function is very convenient. I just type a short prefix (mostly one letter) and press "cursor up". It finds the last matching line.

Scripting shell is sh for me.
 
Bourne shell, for scripting, of course, and zsh, for interactive use. The auto-complete feature in zsh is just amazing. I can even auto complete remote file/dir when I scp with private key, kernel config file when I build, install kernel...

I wish I could do in-line scripting (scripting with command line in interactive mode) with zsh. There are some differences syntaxes, builtin commands in Bourne and zsh.

Is there any setting that I can enable the "bourne shell compability", if it does exist?
 
bsddaemon said:
I wish I could do in-line scripting (scripting with command line in interactive mode) with zsh. There are some differences syntaxes, builtin commands in Bourne and zsh.

Any examples?
 
vermaden said:
Any examples?

I was having problem with in-line command cp (with variable), printf (zsh has it own printf?), complex while or if statement. There are some more but I couldnt remember on top of my head. They work in bourne script file, but didnt work with zsh

afaik, zsh is more bash-like, rather than sh
 
tomh009 said:
The big thing that I love about ksh in general is "set -o vi" which lets me use the navigation keys that are ingrained in body ... navigation without having to think about it, and without having to locate the cursor keys on the keyboard. And note that it also supports "set -o emacs" so there is no need to have a religious discussion about vi vs emacs! :e

Another pdksh user here! The pdksh maintainer was a sysadmin at my school when I was there - they had it deployed for all user accounts campus-wide and it's been my shell of choice for 15 years now. I'm married to the vi commandline editing - in any other shell I'm driving people nuts with beeps when I fire off "[esc]kkk"
 
Citsakots said:
Wow, thank you for such a great post. I didn't know you could do that and also thank you for not feeding me "baby food".

With portupgrade you can automatize that by:
MAKE_ARGS in pkgtools.conf:
'shells/bash' => [
'WITH_INCLUDED_FAQ=yes',
'WITH_STATIC_BASH=yes',
'WITH_INTEGRATED_HELPFILES=yes',
],
AFTERINSTALL in pkgtools.conf:
'shells/bash' => sprintf(
'/root/bin/ports/bash.sh'
),

and create&chmod +x /root/bin/ports/bash.sh with similar content:
#!/bin/sh

cp /usr/local/bin/bash /bin/bash
cp /etc/shells /tmp
grep -iv "bash" /tmp/shells > /etc/shells
echo "/bin/bash" >> /etc/shells

(not cleanly scripts but it working ;). For example it remove records /usr/local/bin/bash for exclude of wrong-headed choice user shell in "adduser"

After that, portinstall and portupgrade shells/bash will be compile static bash, place him to /bin and correct /etc/shells file
 
lazybones said:
I'm married to the vi commandline editing - in any other shell I'm driving people nuts with beeps when I fire off "[esc]kkk"

I'm also "married to the vi commandline editing" as you say! :e
But I am using tcsh, which has the same feature. Just put

Code:
bindkey -v
in .cshrc (or .tcshrc if you like)
 
vermaden said:
Any examples?

Another one:

Code:
func () {
    VARS="a 1 b 2 c 3"

    for var1 var2 in $VARS; do
        echo $var1 $var2
    done
}

This function works fine with zsh, but doesnt work with Bourne

Syntax error: word unexpected

In my script, I have no choice but to define shebang as #!/usr/bin/env zsh :S

Maybe someone has better solution?
 
bsddaemon said:
I wish I could do in-line scripting (scripting with command line in interactive mode) with zsh. There are some differences syntaxes, builtin commands in Bourne and zsh.

Is there any setting that I can enable the "bourne shell compability", if it does exist?

(...)

Another one:

Code:
func () {
    VARS="a 1 b 2 c 3"

    for var1 var2 in $VARS; do
        echo $var1 $var2
    done
}

This function works fine with zsh, but doesnt work with Bourne

In my script, I have no choice but to define shebang as #!/usr/bin/env zsh :S

Maybe someone has better solution?

From man sh:

Code:
     The syntax of the for command is:
           for variable [in word ...]
           do list
           done

This is the syntax of POSIX sh, so there is nothing strange that extended ZSH capabilities ([font="Courier New"]for A S D in ...[/font]) does not work on standart sh, ZSH IS compatible with POSIX sh, I just do not know why you want POSIX sh to be compatible with ZSH extensions.

Other example of that is that for loop that only works at ZSH:
[font="Courier New"]$ for I in {1..10}; do echo $I; done[/font]
 
tomh009 said:
Hmm, not many ksh users out there, it seems. After spending my early years with csh and tcsh, I switched about 20 years ago to ksh, as I could have the same shell on Windows (with MKS Toolkit), and I haven't switched since.

I use pdksh, as none of the ksh93 features seem compelling to me, and I figure that for sure I'd have to relearn something. :)

The big thing that I love about ksh in general is "set -o vi" which lets me use the navigation keys that are ingrained in body ... navigation without having to think about it, and without having to locate the cursor keys on the keyboard. And note that it also supports "set -o emacs" so there is no need to have a religious discussion about vi vs emacs! :e

What do you think of zsh?
 
while I agree that tcsh is a messy old warty piece of sh... shining ;) I am still using it. I guess it's my .cshrc that makes it so appealing to me but I am to lazy to switch
 
with shells/tcshrc tcsh is a very nice piece of software! I just love its programmable completion! :)
 
For root I use tcsh and zsh for regular user in FreeBSD. On Linux land I mainly use bash.

I actually like tcsh quite a bit but I'm looking into zsh (building .zshrc).
 
Back
Top