fish shell
Printing list of numbered files
printf '%03d\n' (seq 0 99)Showing a function or alias
# Replace function_name with your function or alias
type function_nameShowing all functions
functionsadding less variable
less variableFound the answer to this here
The only way I can see to code your specific example is :
function L; env $argv | less --chop-long-lines; endand invoke with
L echo "hello world"-- obviously using a function as a command, not like a zsh global alias.
Defining an Alias
Define alias in shell
alias rmi="rm -i"Define alias in config file
alias rmi="rm -i"This is equivalent to entering the following function:
function rmi
rm -i $argv
endThen, to save it across terminal sessions:
funcsave rmiThis last command creates the file ~/.config/fish/functions/rmi.fish.
Differences between bash and fish:
setting variables
bash:
var=valuefish:
set var value
function arguments
bash:
"$@"fish:
$argv
function local variables
bash:
local varfish:
set -l var
conditionals I
bash:
[[ ... ]]and[ ... ]fish:
test ...
conditionals II
bash:
if cond; then cmds; fifish:
if cond; cmds; end
conditionals III
bash:
cmd1 && cmd2fish:
cmd1; and cmd2fish (as of fish 3.0):
cmd1 && cmd2
command substitution
bash:
output=$(pipeline)fish:
set output (pipeline)
process substitution
bash:
join <(sort file1) <(sort file2)fish:
join (sort file1 | psub) (sort file2 | psub)
Last updated
Was this helpful?