I was trying with [ ] and if statements but your way is simple and works, great stuff!
---------- Post updated at 07:20 AM ---------- Previous update was at 07:10 AM ----------
I was trying with [ ] and if statements but your way is simple and works, great stuff!
actually it works great when there is no parameter VAR# predefined but when parameter is predefined script don show it . . . .
PHP Code:
#!/bin/bash
# write a script that takes command line variables and prints out the
# number of parameters passed in and lists them out on separated lines
VAR1=
VAR2="200"
VAR3=500
[ -z "$VAR1" ] && read -p "Enter VAR1 value:" VAR1
[ -z "$VAR2" ] && read -p "Enter VAR1 value:" VAR2
[ -z "$VAR3" ] && read -p "Enter VAR1 value:" VAR3
exit 0
like here it prompts to enter VAR1
but VAR2 and VAR3 are predefined and are not shown