Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to read data from linux script file and assign it to variables?
How to read data from linux script file and assign it to variables?
In a linux script file, the operation methods and steps of reading data from the file and assigning it to variables are as follows:

1. First, create a file named shell.sh: vi shell.sh, as shown in the following figure.

2. Secondly, after completing the above steps, enter the header file #! /bin/bash, as shown in the figure below.

3. Then, after completing the above steps, save and open the permission (chmod +x shell.sh) and run:. /shell.sh, as shown below.

4. Then, after completing the above steps, enter a string, as shown in the figure below.

5. Then, after completing the above steps, to calculate the value multiplied by 5, you need to edit the shell.sh(vi shell.sh) script command as follows, as shown in the figure below.

6. Finally save and have permission to run: output an integer, as shown in the following figure. In this way, the problem is solved.