Guest User

Untitled

a guest
Aug 17th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.65 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. if [[ -f $1 ]]; then
  4.     echo "File passed."
  5. else
  6.   echo "No file or invalid input."
  7.   exit 1
  8. fi
  9.  
  10. while getopts ':n:p:m:t:' OPTION; do
  11.   case ${OPTION} in
  12.     n )
  13.       nvalue="$OPTARG"
  14.       echo "${OPTARG} node/s were given."
  15.       ;;
  16.     p )
  17.       pvalue="$OPTARG"
  18.       echo "${OPTARG} core/s per node were given."
  19.       ;;
  20.     m )
  21.       mvalue="$OPTARG"
  22.       echo "${OPTARG} memory was given"
  23.       ;;
  24.     t )
  25.       tvalue="$OPTARG"
  26.       echo "${OPTARG} hour/s were given"
  27.       ;;
  28.     \? )
  29.       echo "Script usage: $(basename $0) [-n] [-p] [-m] [-t]" >&2
  30.       exit 1
  31.       ;;
  32.     esac
  33. done
  34. shift "$(($OPTIND -1))"
  35.  
Advertisement
Add Comment
Please, Sign In to add comment