summarylogtreecommitdiffstats
path: root/fix-python-scripts.sh
blob: 2bc55852b3648ab6e9de7ba6a822bde3890b7f16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

if [ -z "$1" ]; then
    echo "Usage: $0 <directory>"
    echo ""
    echo "Makes sure that all python scripts use the python2 command"
    exit 1
fi

for file in $(grep -rl 'env python *$' $1); do
    if [ -z "$file" ]; then
        echo "Error finding files."
        exit 1
    fi
    sed -i 's/env python *$/env python2/g' $file
done