File: fixpath.sh

package info (click to toggle)
erb 1.4.1-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 64 kB
  • ctags: 54
  • sloc: ruby: 468; makefile: 50; sh: 12
file content (14 lines) | stat: -rw-r--r-- 241 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh

for f in `find $1 -type f`
do
  h=`head -1 $f | grep '^#!'`
  if [ -n "$h" ]
  then
    sed -e '1,1s,^#![ 	]*\([^ 	]*\)/\(.*\),#!/usr/bin/\2,' < $f > $f.tmp
    mv -f $f.tmp $f
    chmod -w,+x $f
  else
    chmod -wx $f
  fi
done