Advertisement
Xioth

Bash - TP3 - create-ball2.sh

Jan 18th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.43 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. if [ $# = 0 ]
  4. then
  5.  
  6. cat << END_MY-BALL > my-ball.sh
  7. cat << TAG_CAT > my-id.txt
  8. NOM
  9. Prénom
  10. adresse@mail.com
  11. TAG_CAT
  12. END_MY-BALL
  13.  
  14. elif [ $# = 1 ]
  15. then
  16.     if [ -f $1 ]
  17.     then
  18.  
  19. cat << END_MY-BALL > my-ball.sh
  20. cat $1 > "$1.recreated"
  21. END_MY-BALL
  22.  
  23.     else
  24.         echo "$1 : Introuvable"
  25.         exit 1
  26.     fi
  27. else
  28.     echo "Ce programme n'accepte qu'un seul paramètre au maximum !"
  29.     exit 1
  30. fi
  31.  
  32. chmod 755 my-ball.sh
  33. ./my-ball.sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement