Advertisement
stevennathaniel

Contoh Script Bash 1

Feb 15th, 2013
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.51 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. echo "My name is 'basename $0' - I was called as $0"
  4.  
  5. echo "I was called with $# parameters"
  6.  
  7. if [ "$#" -eq "2" ]; then
  8.  
  9. # the script was called with exactly two parameters, good. let's continue
  10. echo "My first parameter is: $1"
  11. echo "My second parameter is: $2"
  12.  
  13. else
  14.  
  15. # The "$#" variable must tell us that we have exactly two parameters.
  16. # if not we will tell the user how to run the script.
  17.  
  18. echo "Usage: 'basename $0' first second"
  19. echo "You provided $# parameters, but 2 are required."
  20.  
  21. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement