bash
Standa Pacan
baz na yo.cz
Středa Leden 21 23:53:47 CET 2004
> 1. promennou zkratit o posledni znak
lastchar()
{
# return the last character of a string in $rval
if [ -z "$1" ]; then
# empty string
rval=""
return
fi
# wc puts some space behind the output this is why we need sed:
numofchar=`echo -n "$1" | wc -c | sed 's/ //g' `
# now cut out the last char
rval=`echo -n "$1" | cut -b $numofchar`
}
> 2. spocitat pocet znaku promenne
http://www.fi.muni.cz/usr/brandejs/unix/20310.html
Vsechno lze najit pres google:)
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=bash+cut+last+char
nebo v historii konference...
S Pozdravem
Standa Pacan
http://baz.ic.cz
Další informace o konferenci Linux