SHARE
TWEET

askstring

tolikpunkoff May 10th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. ask_string() #1-user ask string, #2-default variant
  4. {
  5.     read -r -p "$1 [$2]:"
  6.    
  7.     if [ -z "$REPLY" ]; then
  8.     if [ -n "$2" ]; then
  9.         STR_RESULT=$2
  10.     fi
  11.     else
  12.     STR_RESULT=$REPLY
  13.     fi
  14. }
  15.  
  16. ask_string "Select path" "/home/smallwolfie/test/testdir"
  17. echo $STR_RESULT
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top