File: unprefix

package info (click to toggle)
lyskom-server 2.1.2-18.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,740 kB
  • sloc: ansic: 51,006; exp: 12,368; sh: 10,501; python: 2,927; makefile: 1,024; yacc: 466; awk: 340; lisp: 271; lex: 218; sed: 50
file content (6 lines) | stat: -rwxr-xr-x 201 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
#!/bin/sh
# usage: unprefix prefix path
#
# Print path, but if it starts with prefix, first remove the prefix.
echo "$2" \
| sed -e 's%^'"`echo $1|sed 's%//*$%%'`"'%%' -e tn -e q -e ':n' -e 's%^//*%%'