A message for Linux.com registered users: We are in the process of making changes to the Linux forums. Starting Monday, 8/13/18 at 6:00 PM PT, you will be unable to access the forums. They will re-launch as soon as possible on Wednesday, 8/15/18 with new features and improved functionality. Thank you for your patience and stay tuned for the new improved forums.

August 12, 2009

Bash scripting

Ok, what I'm trying to do, and for the life of me I can't figure out is:

I'm asking, how many mount points one would like to use

need_input=1
while [ ! -z $c_loop ]; do

while [ -z "$Mountpoints" ]; do Mountpoints="$(user_in " >> How many mount points?: ")" ; done
if [ -z "$( echo $Mountpoints | grep "^[0-9]" )" ]; then
echo " - You must enter a numeric value"
unset Mountpoints
elif [ ! -z "$( echo $Mountpoints | grep "[a-zA-Z]" )" ]; then
echo " - Illegal Character, must be numeric value.. 1-9 10-20, etc?"
unset Mountpoints
else
unset need_input
fi
done

so if I said 5 mount points

The next loop, i'd like to ask 5 times, for each individual directory that it should mount to

if that makes sense?

would appreciate any help thanks - ajay

Nevermind -- I figured it out
loop=0
m_array=()

while [ $loop -le $Mountpoints ]; do
if [ $loop = $Mountpoints ]; then
echo "Completed!"
break
fi

loop=$(( $loop + 1 ))
# Ok, now we're needing to be adding remote mounts,
## I THINK ? lol, RTFM! RTFM! RTFM!
while [ -z ${m_array[loop]} ];
# loop=$(( $loop - 1 ))
do m_array[loop]="$(user_in " >> First mount point: ")" ;

done

echo ${m_array[*]}

done

Thanks though (in advance)

Click Here!