Shell stuff

From ihaveahax's Site
Revision as of 03:24, 22 January 2022 by Ihaveahax (talk | contribs) (Created page with "Some shell stuff I need to keep searching for. == Comparison == <syntaxhighlight lang="bash"> if [ abc = def ]; then echo "Valid" fi </syntaxhighlight> == Arguments == <syntaxhighlight lang="bash"> if $# -eq 0 ; then echo "No arguments" fi echo "First arg: $1" for arg in "$@"; do echo "Arg: $arg" done </syntaxhighlight>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Some shell stuff I need to keep searching for.

Comparison

if [ abc = def ]; then
    echo "Valid"
fi

Arguments

if [[ $# -eq 0 ]]; then
    echo "No arguments"
fi

echo "First arg: $1"

for arg in "$@"; do
    echo "Arg: $arg"
done