Re: From a bash array to a csv file line?
- From: Ed Morton <morton@xxxxxxxxxxxxxx>
- Date: Thu, 28 Sep 2006 15:38:51 -0500
casioculture@xxxxxxxxx wrote:
I want to put all my variables in an array and then have bash "read"
the input from the user (me) at runtime for each and then "echo" their
values with the date to a csv file so that all would be comma-separated
on the same line.
Is this possible? Any ideas?
Is this what you mean:
names=( abc def ghi )
end=${#names[@]}
date=`date`
i=0
while (( i < end ))
do
printf "Enter %s: " "${names[$i]}"
read values[$i]
i=$(( $i + 1 ))
done
i=0
printf "%s" "$date"
while (( i < end ))
do
printf ",%s,%s" "${names[$i]}" "${values[$i]}"
i=$(( $i + 1 ))
done
printf "\n"
Regards,
Ed.
.
- References:
- From a bash array to a csv file line?
- From: casioculture
- From a bash array to a csv file line?
- Prev by Date: Re: From a bash array to a csv file line?
- Next by Date: Re: assign a string variable onto itself with concat ksh
- Previous by thread: Re: From a bash array to a csv file line?
- Index(es):
Relevant Pages
|