Function: Title
Code:
#!/bin/sh
recursive( )
{
for file in $1
do
subfile=`ls $2$3/$file`
for subsubfile in $subfile
do
# echo $subsubfile
if [ "$subsubfile" == "$2$3/$file" ]
then
rm -rf $3/$file
mv $subsubfile $3/$file
else
recursive `ls $2$3/$file` $2 $3/$file;
fi
done
done
}
cd /tmp
mkdir update;
tar -zxvf update.tgz -C update;
chmod -R 755 /tmp/update/*;
rootdir="/tmp/update"
filelist=`ls /tmp/update/`
for file in $filelist
do
subfile=`ls $rootdir/$file`
for subsubfile in $subfile
do
if [ "$subsubfile" != "$rootdir/$file" ]
then
$(recursive `ls $rootdir/$file` $rootdir /$file)
# rm -rf /$file/$subfile
# mv $rootdir/$file/$subsubfile /$file
break 1;
else
kill -9 `ps|grep $file`
rm -f /usr/bin/$file
mv $rootdir/$file /usr/bin
fi
done
done
#reboot
The following are the newly added
Create a soft link for all the files under the folder, the link file can be specified to save to a different directory
When FileList is assigned, you can specify the source path,
In the following "Ln-s $file arm-linux-" $LASTWD "", you can specify the directory of the linked file, such as the source path is the current path, the target path is the current path
#/bin/bash
filelist= ' ls./'
For file in $filelist
Do
firstwd= $file | Cut-d "-"-f1
# if ["$firstwd" = = "Arm"]
# Then
Lastwd= ' echo ' $file | Sed ' s/.*-\ ([^-]*\) $/\1/'
Echo $LASTWD
Ln-s $file arm-linux-"$LASTWD"
# fi
Done