Last active
March 15, 2023 16:19
-
-
Save zfhxi/79658216f17e3fc43b6bc6cbdcceb56e to your computer and use it in GitHub Desktop.
Revisions
-
zfhxi revised this gist
Mar 15, 2023 . 1 changed file with 7 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,10 @@ #!/bin/bash BIN_PATH=$1/bin PYTHON_INTERPRETER="#!$(realpath $BIN_PATH/python)" for file in $BIN_PATH/* do if [[ $(file -b "$file") == *"Python script"* ]];then sed -i "1s|.*|$PYTHON_INTERPRETER|g" $file fi done -
zfhxi created this gist
Sep 25, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ #!/bin/bash current_interpreter=/opt/cszmxApps/Miniconda3/envs/tfan/bin/python target_interpreter_dir=/home/denglong/.miniconda3/envs/tfan/bin target_interpreter=$(realpath "$target_interpreter_dir""/python") echo "current_interpreter: $current_interpreter" echo "target_interpreter: $target_interpreter" for bin_file in $target_interpreter_dir/* do if test -f $bin_file then # bin_file_list=(${bin_file_list[*]} $bin_file) sed "s!$current_interpreter[\d\.]*!$target_interpreter!g" $bin_file |head -n 1 # sed -i "s!$current_interpreter[\d\.]*!$target_interpreter!g" $bin_file fi done # echo ${bin_file_list[@]}