<required_argument>
[optional_argument]
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html
for x in π π π
do
echo ${x}
done
xs=(π π π)
for x in "${xs[@]}"
do
echo ${x}
done
xs=(
π
π
π
)
for x in "${xs[@]}"
do
echo ${x}
done
for dir in */
do
echo $dir
done
for dir in **/
do
echo $dir
done
echo $(realpath $0)
echo $(cd ${0%/*} && pwd -P)
echo ${0##*.}
exec -l $SHELL
date +%Y-%m-%d_%H-%M-%S
s=πππ
echo ${s#?} # ππ
echo ${s%?} # ππ
directory=~/Desktop/foo
[ -e ${directory} ] || mkdir -p ${directory}
echo π > /dev/null # redirects stdout only.
echo π 2> /dev/null # redirects stderr only.
echo π &> /dev/null # redirects both stdout and stderr.
S=π_π
echo ${S/π} # _π
echo ${S//π} # _
echo ${S/π/π} # π_π
echo ${S//π/π} # π_π
cat << EOF > sample.txt
π
π
π
EOF
file --brief input.txt
rsync --archive src dst
$ cat input.txt
π
π
π
$ paste -s -d, input.txt
π,π,π
$ cat left.txt
π
π
$ cat right.txt
π
π
$ paste -d, left.txt right.txt
π,π
π,π
$ paste -d'\0' left.txt right.txt
ππ
ππ
my_function() {
if [ $# -lt 2 ]
then
echo "Usage: $funcstack[1] <first-argument> <second-argument>"
return
fi
echo "First argument: $1"
echo "Second argument: $2"
}
$ my_function
Usage: my_function <first-argument> <second-argument>
$ my_function foo
Usage: my_function <first-argument> <second-argument>
$ my_function foo bar
First argument: foo
Second argument: bar
s=sample.txt
echo $s:r # sample
echo $s:e # txt
<command> &|
https://zsh.sourceforge.io/Doc/Release/Shell-Builtin-Commands.html
-t
is a separator-1
is the one-based index of a matching column from a first input file.-2
is the one-based index of a matching column from a second input file.
$ cat foo.txt
1,aa
2,bb
4,cc
$ cat bar.txt
1,xx
2,yy
5,zz
$ join -t, -1 1 -2 2 foo.txt bar.txt
1,aa,xx
2,bb,yy