This record is used as a memo by a student who is doing JS properly. Don't expect the content.
The shell interprets the commands entered on the screen and passes them to the kernel. The kernel is the core of the OS. Also, the result output by this kernel is passed to the shell and displayed on the screen. Simply put, it is a function that wraps the core part (kernel) of the OS and interacts with the OS. A shell script is the scripting language used by this shell. In general, shell scripts do not perform complicated tasks, but automate routine tasks, record tasks, and process multiple commands at once. A common shell on Linux is bash, which we will use this time.
touch firstshell.sh
The touch command creates an empty file for Ubuntu if the file with the name passed as an argument does not exist. If it exists, it updates the modification date and time of the file or directory.
To execute this shell script in the bash shell located in / bin / bash, write the following.
#!/bin/bash
I wanted to make a quiz here, so I added the following.
if [ $yn = "n" ]; then
echo Incorrect answer.
else
echo Correct answer.
fi
The read command seems to be able to receive variables while displaying characters with -p "string". In this script, y or n is assigned to the variable yn. The following is a simple conditional branch, so don't forget to add fi at the end.
In order to run the shell script program, it is necessary to give the file permission to execute it, and this time I wrote the following in the console so that it can be executed by all users.
chmod a+x firstshell.sh
Run this script with a relative path including ./
./firstshell.sh
Then it moved smoothly unexpectedly. Yes, protein is protein. No particular error occurred, so this is the end of this time. Thank you for your hard work.
Recommended Posts