Два скрипта . Линукс 1)Create script using pico which will output the number of days passed since the beginning of the year. 2)Create script which will ask user to provide a value and then, according to the value provided: 1 - set some environmental variable 2 - output this environmental variable 3 - erase this environmental variable 4 - exit without errors Any other - exit with error
1) Script to output the number of days passed since the beginning of the year:
#!/bin/bashdays=$(date +"%j")
echo "Number of days passed since the beginning of the year: $days"
Save this script as days_passed.sh and run it using ./days_passed.sh.
2) Script to set, output, erase environmental variable or exit:
#!/bin/bashecho "Enter a value:"
read value
case $value in
1)
echo "Enter a value to set the environmental variable:"
read var_value
export ENV_VAR="$var_value"
echo "Environmental variable set"
;;
2)
echo "Environmental variable value: $ENV_VAR"
;;
3)
unset ENV_VAR
echo "Environmental variable erased"
;;
4)
exit 0
;;
*)
echo "Error: Invalid option entered"
exit 1
;;
esac
Save this script as env_var_operations.sh and run it using ./env_var_operations.sh.