Ako upravit xf86config ?
Stepan Kasal
kasal na matsrv.math.cas.cz
Pondělí Květen 25 18:59:26 CEST 1998
Ahoj,
> > fromdos < XF86Config.dos > XF86Config
On 25 May 1998 11:23:11 +0200, Jaroslav Benkovsky wrote:
> Ehm.. A co radsi tr -d "\015" <XF86Config.dos >XF86Config
jeste tam muze zbyt ^Z na konci a posledni radek nemusi byt
ukonceny \n. Ja pouzivam skript (parametry to umi):
#!/bin/sh
#
# dos2unix
#
# Je dobrym zvykem na Unixu, ze i posledni radek je ukoncen \n.
# Pokud by vstupni soubor koncil neuplnym radkem, tento script
# jej ukonci \n.
move=n
if [ $# = 1 ]
then if [ $1 = - ]
then outfile=-
else outfile=`mktemp /tmp/D_XXXXXX`; move=y
fi
elif [ $# = 2 ]
then outfile=$2
else
echo "Usage: $0 infile [ outfile ]" >&2
echo " (any file may be "-" for stdin)" >&2
exit 1
fi
tmpfile=`mktemp /tmp/D_XXXXXX`
cmd='echo "" >$tmpfile && cat $1 $tmpfile |
tr -d "\032\r" | sed '\''${;/^$/d;}'\'
if [ $outfile != - ]
then
cmd=$cmd'>$outfile'
rmout='rm -f $outfile'
fi
if eval $cmd
then if [ $move = y ]
then if cat $outfile >$1
then rm -f $outfile || echo "$0: rm $outfile failed" >&2
else echo "$0: Converted file is stored as $outfile." >&2
fi
fi
else
echo "$0: Broken pipe or conversion failed." >&2
eval $rmout
fi
rm -f $tmpfile
A jako druhy mam script unix2dos:
---------------
#!/bin/sh
#
# unix2dos
#
# Je dobrym zvykem na Unixu, ze i posledni radek je ukoncen \n.
# Pokud by preci jen nebyl, tento script jej doplni, takze vystup
# bude vzdy koncit \r\n\032 (\032 je EOF cili ^Z).
move=n
if [ $# = 1 ]
then if [ $1 = - ]
then outfile=-
else outfile=`mktemp /tmp/D_XXXXXX`; move=y
fi
elif [ $# = 2 ]
then outfile=$2
else
echo "Usage: $0 infile [ outfile ]" >&2
echo " (any file may be "-" for stdin)" >&2
exit 1
fi
tmpfile=`mktemp /tmp/D_XXXXXX`
cmd='printf "\r\n">$tmpfile && cat $tmpfile $1|sed "1{;h;d;};G;s/\n//" '
if [ $outfile = - ]
then
cmd=$cmd' && printf "\032" '
else
cmd=$cmd'>$outfile && printf "\032" >>$outfile '
rmout='rm -f $outfile'
fi
if eval $cmd
then if [ $move = y ]
then if cat $outfile >$1
then rm -f $outfile || echo "$0: rm $outfile failed" >&2
else echo "$0: Converted file is stored as $outfile." >&2
fi
fi
else
echo "$0: Broken pipe or conversion failed." >&2
eval $rmout
fi
rm -f $tmpfile
-------------------- Stepan
Další informace o konferenci Linux