Add sudo for readlink calls in edit
This commit is contained in:
parent
b1db4da9f1
commit
7300c7a813
1 changed files with 7 additions and 3 deletions
10
.bin/edit
10
.bin/edit
|
@ -22,16 +22,20 @@ _pre_checks_file() {
|
|||
fi
|
||||
}
|
||||
|
||||
_readlink() {
|
||||
sudo readlink -fn "$1"
|
||||
}
|
||||
|
||||
_get_edit_directory() {
|
||||
target_dir=$(dirname "$1")
|
||||
edit_dir_sub=$(readlink -fn "$target_dir" | md5sum | awk '{ print $1 }')
|
||||
edit_dir_sub=$(_readlink "$target_dir" | md5sum | awk '{ print $1 }')
|
||||
|
||||
edit_directory="$edit_dir_base/$edit_dir_sub/"
|
||||
echo "$edit_directory"
|
||||
}
|
||||
|
||||
_get_edit_file() {
|
||||
target=$(readlink -fn "$1")
|
||||
target=$(_readlink "$1")
|
||||
target_name=$(basename "$target")
|
||||
edit_directory=$(_get_edit_directory "$target")
|
||||
|
||||
|
@ -40,7 +44,7 @@ _get_edit_file() {
|
|||
}
|
||||
|
||||
_prepare_for_edit() {
|
||||
target=$(readlink -fn "$1")
|
||||
target=$(_readlink "$1")
|
||||
|
||||
_pre_checks_file "$target"
|
||||
|
||||
|
|
Loading…
Reference in a new issue