scripting - When running bash script that calls another script getting EOF error -
the other script read statement echo'ed file script
#!/usr/bin/bash # createdb_wrapper.scr # log information user of createdb.scr default_dir=/export/home/cwatts/test default_log=db.audit while [ -z "${fname}" ] echo "please, enter fullname [enter]:" read fname done
tried various ways pull information other script dbname="./createdb.scr | awk '{print $1}'"
sh $dbname while [ -z "${desc}" ] echo "please,enter brief description [enter]: read desc done #checks directory exists, , creates if not if [ ! -d $default_dir ] ;then echo "directory doesn't exit, created" mkdir $default_dir fi echo `date -u` '|' $dbname '|' $fname '|' $desc >> $default_dir/$default_log exit
you forgot other quote:
echo "please,enter brief description [enter]:
should be
echo "please,enter brief description [enter]:"
i recommend form:
#!/bin/bash # # createdb_wrapper.scr # log information user of createdb.scr # default_dir='/export/home/cwatts/test' default_log='db.audit' until read -p "please, enter fullname [enter]: " fname && [[ -n $fname ]]; : done until read -p "please,enter brief description [enter]: " desc && [[ -n $desc ]]; : done if [[ -d $default_dir ]]; echo "directory not exist. created." mkdir "$default_dir" fi echo "$(exec date -u) | $dbname | $fname | $desc" >> "$default_dir/$default_log"
note: $dbname
not set.
Comments
Post a Comment