Hi
I need to use the script below to make a script that concatenate 2 lists together so the input to the script will be colon or space separated lists and the output will be a single colon separated list with all redundant items removed.
I would appreciate any help and pointers to get me started.
#!/bin/sh
for P in `echo $PATH | sed -e 's/^:/.:/' -e 's/::/:.:/' -e 's/:$/:./' -e 's/:/ /g'`
do
case $NP in
""
if [ -d "$P" ]
then
NP="$P"
fi
;;
$P|$P:*|*:$P:*|*:$P)
continue
;;
*)
if [ -d "$P" ]
then
NP="$NP:$P"
fi
;;
esac
done
echo $NP
I need to use the script below to make a script that concatenate 2 lists together so the input to the script will be colon or space separated lists and the output will be a single colon separated list with all redundant items removed.
I would appreciate any help and pointers to get me started.
#!/bin/sh
for P in `echo $PATH | sed -e 's/^:/.:/' -e 's/::/:.:/' -e 's/:$/:./' -e 's/:/ /g'`
do
case $NP in
""
if [ -d "$P" ]
then
NP="$P"
fi
;;
$P|$P:*|*:$P:*|*:$P)
continue
;;
*)
if [ -d "$P" ]
then
NP="$NP:$P"
fi
;;
esac
done
echo $NP