Hi! > > This is bashism. The portable way to do this seems to be do > > tr -d [:digit:] on the string and checking if result is empty or use > > grep. > > Indeed, 'tr' may be used in this case, but an (AFAIK) portable > replacement for =~ is expr(1):
I do not care much about the way it's implemented. All we need is that the code runs fine at least with bash, dash and bussybox. > if ! expr "$timeout" : '.*[0-9]\+$' >/dev/null; then > > although, as you can see, there are several limitations: > > - IIRC the busybox version doesn't support '+ TOKEN' syntax, so we > rely on ie. $timeout != "match" > - different implementations may have different syntax, although the > `:' notation is AFAIK the oldest > - regexp matching is always done from the beginning, so there's `^' > implied > - path to /dev/null may be different on some systems (_PATH_DEVNULL), > not sure if "/dev/null" is a POSIX requirement We rely on /dev/null heavily in all parts of LTP. The goal is to be portable across various Linux distributions, even embedded ones. We do not care about rest of the UNIX world much (the exception is the Open Posix Testsuite which should be written to the POSIX standard). Ahd the whole problem reminds me an old saying: "I'ts easier to implement portable shell than a porable shell code." -- Cyril Hrubis chru...@suse.cz ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list