echo "test stdout >" # echo 命令的輸出寫入到 output.txt 文件中,如果文件已經存在,會覆蓋原有內容。 echo hello world > output.txt # 查看 output.txt 的內容 cat output.txt echo # 再次使用 > 會覆蓋原內容 echo "test stdout >" echo test test > output.txt # 查看 output.txt 的內容 cat output.txt echo # 將 echo 命令的輸出附加到 output.txt 文件的末尾 echo "test stdout >>" echo hello world >> output.txt # 查看 output.txt 的內容 cat output.txt
Write, Run & Share Bash code online using OneCompiler's Online Bash Shell for free. It's one of the robust, feature-rich Bash shell available over online and getting started with the OneCompiler's Bash Shell is simple and pretty fast. The editor shows sample boilerplate code when you choose language as Bash
. OneCompiler also has reference scripts, where you can look for the sample scripts and start coding.
Bash (Bourne Again Shell) is a shell program written by Brian Fox and is an upgraded version of Bourne Shell program 'sh'.
name="Foo"
echo $name
echo "$name"
echo "${name}"
if [ conditional-expression ]
then
statements
fi
if [ conditional-expression ]
then
statements
else
statements
fi
if [ conditional-expression ]
then
statements
elif [ conditional-expression ]
then
statements
else
statements
fi