android13/rkst/correct-run

41 lines
873 B
Plaintext
Raw Permalink Normal View History

2024-06-22 08:45:49 -04:00
#!/bin/sh
# change run file
TMP_FILE=run.tmp
rm -f $TMP_FILE
exportline()
{
# echo $LINE
file=$(echo $LINE|awk -F" " 'NF==3&&$1=="wl"{print $1" "$2" "$3}''NF==3&&$1=="#wl"{print "wl "$2" "$3}''NF==4&&$1=="#"&&$2=="wl"{print $2" "$3" "$4}')
if [ "$file"x != ""x ]; then
LINE="$file"
fi
file=$(echo $LINE|awk -F" " '$1=="wl"{print $3}')
if [ "$file"x = ""x ]; then
echo $LINE >> $TMP_FILE
else
file=$(echo $file|awk 'gsub("\r", "") {print $0}')
if [ -f "$file" ] ;then
echo $LINE >> $TMP_FILE
else
echo "#$LINE" >> $TMP_FILE
fi
fi
}
while read LINE
do
exportline $LINE
done < $1
if [ "$LINE"x != ""x ]; then
exportline $LINE
fi
rm -f $1
mv $TMP_FILE $1
chmod 777 $1