mirror of
https://github.com/Mibew/mibew.git
synced 2025-03-03 18:38:31 +03:00
Make flat_cp tool portable to systems without GNU sed
This commit is contained in:
parent
1c9430286c
commit
bac1404cf1
@ -23,17 +23,17 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
source_file=$1
|
source_file=$1
|
||||||
cut_from=$(sed -r "s/\/+$//" <<< "$3")
|
cut_from=$(sed "s/\/\{1,\}$//" <<< "$3")
|
||||||
|
|
||||||
if [ $cut_from ]
|
if [ $cut_from ]
|
||||||
then
|
then
|
||||||
cut_from=$(sed -r "s/\//\\\\\//g" <<< "$cut_from")
|
cut_from=$(sed "s/\//\\\\\//g" <<< "$cut_from")
|
||||||
target_file_name=$(sed -r "s/^(.*)$cut_from\/(.*)$/\2/" <<< "$source_file")
|
target_file_name=$(sed "s/^\(.*\)$cut_from\/\(.*\)$/\2/" <<< "$source_file")
|
||||||
else
|
else
|
||||||
target_file_name=$source_file
|
target_file_name=$source_file
|
||||||
fi
|
fi
|
||||||
|
|
||||||
target_file_name=$(sed -r "s/\//_/g" <<< "$target_file_name")
|
target_file_name=$(sed "s/\//_/g" <<< "$target_file_name")
|
||||||
target_file=$(sed -r "s/\/?$//" <<< "$2")"/"$target_file_name
|
target_file=$(sed "s/\/\{0,1\}$//" <<< "$2")"/"$target_file_name
|
||||||
|
|
||||||
cp $source_file $target_file
|
cp $source_file $target_file
|
Loading…
Reference in New Issue
Block a user