A shell can be used interactively & non-interactively. But what is your favorite & why ?
I recently learned mksh, once you know vi-keys it's quiet ok.
I recently learned mksh, once you know vi-keys it's quiet ok.
tcsh
which has the big disadvantage of treating exclamation marks as commands even when configured otherwise (if anyone could guide me how to have “!!” in strings, like archive passwords, not mess with my history, please do!), my interactive shell is rc
(with readline), because it does not get in my way. No quirky highlighting, no pseudo-intelligent (wrong) auto-completion, no integration of VCSs I don’t even use, a decent scripting language for (e.g.) performing commands on a list of files. bosh
from the schily tools, because it aims to be 100% POSIX-compliant (= portable), but I really don’t write many shell scripts - the language is ugly and hard to maintain.Do you simply mean /bin/sh or a different version of that shell?Almquist shell https://en.wikipedia.org/wiki/Almquist_shell
It's very similar to Bash and it's much faster in performance.
It's FreeBSD's default shell I mean. I think it's /bin/shDo you simply mean /bin/sh or a different version of that shell?
tcsh
, most likely because a C shell comes with BSD "by tradition" and tcsh offers some nice interactive features.bash
or zsh
(I personally prefer zsh...) set v = `myfile.txt`
set i = 1
while ( $i < = $#v )
echo $v[$i]
@ i = $i + 1
end
You are absolutely right. I forgot to include "cat" inNot sure if that's csh/tcsh syntax.
first the backticks on set v = typically mean "execute this command" and would set v to the output of the command.
if you change that line to:
set v = `cat myfile.txt`
Then it sets v to the contents of myfile.txt
Typically $# is "number of arguments, the $#v is "number of arguments in v"
If myfile.txt has:
one
two
three
four
five
it prints 5 lines
If it has:
one
two
three
four
five six seven
you get 7 because whitespace is the default delimiter.
set v = `cat myfile.txt`
. This loop strategy was recommended as a way to sequentially feed a list of arguments to a command from a text file and I have to say it worked very well. I am sure with a huge file there would be a risk of crashing due to slurping the whole file at once into memory as opposed to reading the file a line at a time as can be done in bash with readline. At that point probably a perl or python script would make more sense though.> cd /usr/ports
> find . -type d -name fish*
find: No match.
> find . -type d -name *fish*
find: No match.
> cd shells
> ls
../ heirloom-sh/ rc/
./ ibsh/ rubygem-shellwords/
44bsd-csh/ ion/ rush/
Makefile jailkit/ sash/
anongitssh/ klish/ scponly/
antibody/ ksh-devel/ starship/
ast-ksh/ ksh/ switchBashZsh/
bash-completion/ ksh2020/ tcsh_nls/
bash-static/ ksh93/ tcshrc/
bash/ mksh/ v7sh/
bashc/ modernish/ viewglob/
bicon/ nologinmsg/ vshnu/
bosh/ nsh/ wcd/
ch/ ohmyzsh/ xonsh/
dash/ oksh/ yash/
elvish/ p5-Bash-Completion/ zsh-antigen/
envy/ p5-Shell-Perl/ zsh-autosuggestions/
es/ p5-Term-Bash-Completion-Generator/ zsh-completions/
etsh/ p5-Term-ShellUI/ zsh-navigation-tools/
fd/ pdksh/ zsh-syntax-highlighting/
fish/ pear-PHP_Shell/ zsh/
git-prompt.zsh/ psh/
Not sure if this is a tcsh thing or a find thing but the behavior was unexpected ( for me anyway ).
Code:> cd /usr/ports > find . -type d -name fish* find: No match. > find . -type d -name *fish* find: No match. > cd shells > ls ../ heirloom-sh/ rc/ ./ ibsh/ rubygem-shellwords/ 44bsd-csh/ ion/ rush/ Makefile jailkit/ sash/ anongitssh/ klish/ scponly/ antibody/ ksh-devel/ starship/ ast-ksh/ ksh/ switchBashZsh/ bash-completion/ ksh2020/ tcsh_nls/ bash-static/ ksh93/ tcshrc/ bash/ mksh/ v7sh/ bashc/ modernish/ viewglob/ bicon/ nologinmsg/ vshnu/ bosh/ nsh/ wcd/ ch/ ohmyzsh/ xonsh/ dash/ oksh/ yash/ elvish/ p5-Bash-Completion/ zsh-antigen/ envy/ p5-Shell-Perl/ zsh-autosuggestions/ es/ p5-Term-Bash-Completion-Generator/ zsh-completions/ etsh/ p5-Term-ShellUI/ zsh-navigation-tools/ fd/ pdksh/ zsh-syntax-highlighting/ fish/ pear-PHP_Shell/ zsh/ git-prompt.zsh/ psh/