Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # viewing environment variables
  4. echo "The value of the home variable is: "
  5. echo $HOME
  6.  
  7. # issue a command
  8. echo "The output of the pwd command is: "
  9. pwd
  10.  
  11. # that's boring, grab output and make it readable
  12. echo "The value of the pwd command is $(pwd)"
  13.  
  14. # assign command output to a variable
  15. output=$(pwd)
  16. echo "The value of the output variable is ${output}"
  17.  
  18. # view data on the command line
  19. echo "I saw $@ on the command line"
  20.  
  21. # read data from the user
  22. echo "Enter a value: "
  23. read userInput
  24. echo "You just entered $userInput"
  25.  
  26. # concatenate userinput with command output
  27. echo "Enter a file extension: "
  28. read ext
  29. touch "yourfile.${ext}"
  30.  
  31. # check to see if a file exists
  32. if [ -d /etc/sysconfig ]; then
  33. echo "That file is there and a directory"
  34. else
  35. echo "Not there or not a directory"
  36. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement