Nytt utkast (betoning på utkast). Löser även mappar vars namn innehåller mellanslag.
På att-göralistan finns:Kod:#! /bin/bash clear mountpoint="/DATA/download/ALL_AND_ALL/" dirarray[0]="/DATA/download/MOUNT_1/" dirarray[1]="/DATA/download/MOUNT_2/" if [[ $1 = "build" ]];then dircount=0 while [ $dircount -lt ${#dirarray[*]} ] do cd "${dirarray[$dircount]}" cnt=0 Dirlist=$(ls -d */) for line in $Dirlist ; do if [[ ${line:(-1)} != "/" ]];then if [[ -z $templine ]];then templine="$line" else templine="$templine $line" fi else if [[ -n $templine ]];then line="$templine $line" fi unset $templine myarray[$cnt]="$line" export cnt=$(($cnt+1)) fi done ncnt=0 while [ $ncnt -lt $cnt ] do ln -s "${dirarray[$dircount]}${myarray[$ncnt]}" "$mountpoint" ncnt=$(($ncnt+1)) done dircount=$(($dircount+1)) done else echo "Hello" fi
Städa kod
Tömma mountpoint på existerande länkar (ln -s)