hallo,
ich habe hier ein Problem mit einem kleinen shellscript.
Das Skript soll prüfen ob es sich um ein Linux oder *bsd system handelt
und dann die alte Datei sichern bevor die neue kopiert wird, da BSD cp dei option -u nicht kennt.
Wenn ich Linux!=Linux setzte,(nur zu Testzwecken, soll später mit `uname`funktioniern)
habe ich folgende Ausgabe und die tcshrc.local wird nicht kopiert.
Bei Linux==Linux folgende:
Vielleicht kann mir jemand mit ein wenig mehr Erfahrung mit shellscripten weiterhelfen.
Hier die komplette tcshrc_config
http://nopaste.bsdforen.de/189
MfG
ich habe hier ein Problem mit einem kleinen shellscript.
Das Skript soll prüfen ob es sich um ein Linux oder *bsd system handelt
und dann die alte Datei sichern bevor die neue kopiert wird, da BSD cp dei option -u nicht kennt.
PHP:
if [ "$USER" = "y" ] ; then
echo -n "Copying files from ${SOURCE} to ${HOME}..." >&2
/bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc ${HOME}/.tcshrc
/bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc.bindkey ${HOME}/.tcshrc.bindkey
/bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc.complete ${HOME}/.tcshrc.complete
/bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc.set ${HOME}/.tcshrc.set
/bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc.alias ${HOME}/.tcshrc.alias
/bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc.hosts ${HOME}/.tcshrc.hosts
if ["`uname`" == "Linux"] ; then
if ["-e ${HOME}/.tcshrc.local"] ; then
/bin/cp -f ${VERBOSE} ${HOME}/.tcshrc.local ${HOME}/.tcshrc.local.old
/bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc.local ${HOME}/.tcshrc.local
else
/bin/cp -u ${VERBOSE} ${SOURCE}/tcshrc.local ${HOME}/.tcshrc.local
fi
fi
echo " done." >&2
exit 0
fi
Wenn ich Linux!=Linux setzte,(nur zu Testzwecken, soll später mit `uname`funktioniern)
habe ich folgende Ausgabe und die tcshrc.local wird nicht kopiert.
Code:
root@ /root
# /usr/local/bin/tcshrc_config -v -u
Copying files from /usr/local/share/tcshrc to /root.../usr/local/share/tcshrc/t
shrc -> /root/.tcshrc
/usr/local/share/tcshrc/tcshrc.bindkey -> /root/.tcshrc.bindkey
/usr/local/share/tcshrc/tcshrc.complete -> /root/.tcshrc.complete
/usr/local/share/tcshrc/tcshrc.set -> /root/.tcshrc.set
/usr/local/share/tcshrc/tcshrc.alias -> /root/.tcshrc.alias
/usr/local/share/tcshrc/tcshrc.hosts -> /root/.tcshrc.hosts
done.
Bei Linux==Linux folgende:
Code:
root@ /root
# /usr/local/bin/tcshrc_config -v -u
Copying files from /usr/local/share/tcshrc to /root.../usr/local/share/tcshrc/
shrc -> /root/.tcshrc
/usr/local/share/tcshrc/tcshrc.bindkey -> /root/.tcshrc.bindkey
/usr/local/share/tcshrc/tcshrc.complete -> /root/.tcshrc.complete
/usr/local/share/tcshrc/tcshrc.set -> /root/.tcshrc.set
/usr/local/share/tcshrc/tcshrc.alias -> /root/.tcshrc.alias
/usr/local/share/tcshrc/tcshrc.hosts -> /root/.tcshrc.hosts
[: Linux: unexpected operator
done.
Vielleicht kann mir jemand mit ein wenig mehr Erfahrung mit shellscripten weiterhelfen.
Hier die komplette tcshrc_config
http://nopaste.bsdforen.de/189
MfG