Description: Basic shell script using WSL on Windows 11.
| Attribute | Value |
|---|---|
| Machine | ASUS VIVO BOOK, Mouse Windows 11 |
| Linux (WSL) | Ubuntu 24.04.1 LTS |
| IDE | VS Code |
uname -a |
Linux asus-oda 5.15.167.4-microsoft-standard-WSL2 1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux |
pwd |
/home/miura |
whoami |
miura |
which bash |
/usr/bin/bash |
| Current Directory | /home/miura/WECM100 |
#!/usr/bin/bash
if [ -e ./base01.sh ]; then
echo "base01.sh is exist"
else
echo "base01.sh not exist"
fi
exit
#!/usr/bin/bash): Correct and necessary for executing the script.if [ -e ./base01.sh ] checks if the script file itself exists. This is a basic but useful check, especially during initial development.exit command is included, which is good practice, although in this simple script, it's not strictly necessary.Commands:
$ chmod +x base01.sh
$ ./base01.sh
Result:
base01.sh is exist