Denys Vlasenko <vda.linux-gM/[email protected]>
writes:

> Hi Dmitry,
>
>  for file in "$logfile".*; do
>         [ -f "$file" ] || continue
> -       suffix=${file:1+$pfxlen}
> -       [ "$suffix" -gt 0 ] 2> /dev/null || {
> -               echo "Skipped file '$file' (bad suffix)" >&2
> +       suffix=${file#$logfile.}
>
> suffix=${file#$logfile.} is not a good way to strip $logfile prefix:
> ${var#pattern} operation interprets <pattern>, indeed, as glob pattern.

Unless quoted.

> Try this:
>
> logfile="????"
> file=FILE.123
> suffix=${file#$logfile.}
  suffix=${file#"$logfile".}
> echo "$suffix"

> I think we'd better use suffix=${file:1+$pfxlen}.

This is not portable.

Andreas.

-- 
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to