Ubuntu Pastebin

Paste from capricorn One at Tue, 2 Jun 2015 05:36:24 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
LOG=~/log/myapp.log

[ ! -d $LOG_DIR ] && mkdir ~/LOG_DIR

prompt="enter your variable value"

read -p $prompt var
echo -e "${var}\t${mydate}" >> $LOG

#########
usr_input() {
# user input; return an answer or default
question=$1
if [ $# -gt 1 ]; then
    default=$2
    read -p "$question [$default]? " answer
    if [ "$answer" == "" ]; then
        answer=$default
    fi
else
    read -p "$question? " answer
fi
echo $answer
}
Download as text