Chapter 3 Challenges
From Linux Shell Scripting Tutorial - A Beginner's handbook
- Make a backup of existing variable called PS1 to OLDPS1. Set PS1 to '$'. Reset your prompt using OLDPS1 variable.
- Customize your bash prompt by setting PS1 variable to 'I Love Scripting '.
- Edit your $HOME/.bashrc file and set your new PS1 variable.
- Create a list of legal and illegal bash variable names. Describe why each is either legal or illegal.
- Write a command to display the environment.
- Write a shell script that allows a user to enter his or her top three ice cream flavors. Your script should then print out the name of all three flavors.
- Write a shell script that allows a user to enter any Internet domain name (host name such as www.cyberciti.biz). Your script should than print out the IP address of the Internet domain name.
- Write a shell script that allows a user to enter any existing file name. The program should then copy file to /tmp directory.
- Write a shell script that allows a user to enter directory name. The program should then create directory name in /tmp directory.
- Write a shell script that allows a user to enter three file names. The program should then copy all files to USB pen.
- Write a simple shell script where the user enters a pizza parlor bill total. Your script should then display a 10 percent tip.
- Write a simple calculator program that allows user to enter two numeric values and operand as follows. The program should then print out the sum of two numbers. Make sure it works according to entered operand.
Enter two values : 10 20 Enter operand ( +, -, /, *) : + Output: 10 + 20 = 30