Linux:Shell Scripts
(Változatok közti eltérés)48. sor: | 48. sor: | ||
</megoldas> | </megoldas> | ||
- | * Create a program that takes its parameters from a configuration file! Read the variables named NAME and AGE from the params.conf file and print their values.<code lang="bash"> | + | * Create a program that takes its parameters from a configuration file! Read the variables named NAME and AGE from the params.conf file and print their values. |
+ | <code lang="bash"> | ||
#!/bin/bash | #!/bin/bash | ||
. params.conf | . params.conf | ||
echo "Name: $NAME, age: $AGE years." | echo "Name: $NAME, age: $AGE years." | ||
- | </code> | + | </code><megoldas> |
</megoldas> | </megoldas> | ||
<box> | <box> |
A lap 2021. április 15., 05:55-kori változata
- Create a text file of any content with mcedit! The file name should be test.txt!
- Create a shell script that prints the following text: Hello world!
- Create a program that assigns a value to variable named A and then shows its value.
- Create a program that asks for the user's name from the keyboard and greets him in person!
- Create a program that prints the English abbreviation of today's name! The name of the current day can be obtained by properly parameterizing the date command. (Use the man page of the date command!)
- Create a program that asks the length of the side of a square and then displays its perimeter and area. The name of the program should be square!
- Create a program that takes its parameters from a configuration file! Read the variables named NAME and AGE from the params.conf file and print their values.
#!/bin/bash . params.conf echo "Name: $NAME, age: $AGE years."
Content of params.conf: NAME="Kiss Lajos" AGE=60