Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- function chandir {
- echo 'Please enter the name of directory you want to change to: '
- read nameofd
- cd $nameofd
- }
- function createdir {
- echo 'Please enter the name of directory which you want to create: '
- read nameofcd
- mkdir $nameofcd
- }
- function removedir {
- echo 'Please enter the name of directory which you want to delete: '
- read nameofrd
- echo "Are you sure that you want to remove $nameofrd (y/yes - if yes)"
- read cond
- if [ $cond = "y" ] | [ $cond = "yes" ]; then
- rm -r $nameofrd
- else
- echo "Directory wasn't removed"
- fi
- }
- while true
- do
- echo '
- Select menu option:
- 1. current directory
- 2. change directory
- 3. print content of current directory
- 4. create directory
- 5. remove directory
- 6. exit
- '
- read menu
- case $menu in
- 1)
- pwd
- ;;
- 2)
- chandir
- ;;
- 3)
- ls -la
- ;;
- 4)
- createdir
- ;;
- 5)
- removedir
- ;;
- 6)
- exit 1
- ;;
- *)
- echo 'Invalid input'
- ;;
- esac
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement