Move .local/bin to .bin
This commit is contained in:
		
							parent
							
								
									b8dd204681
								
							
						
					
					
						commit
						76f407954f
					
				
					 16 changed files with 58 additions and 38 deletions
				
			
		| 
						 | 
				
			
			@ -1,32 +0,0 @@
 | 
			
		|||
#!/usr/bin/sh
 | 
			
		||||
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
edit_directory="$HOME/.cache/edit/"
 | 
			
		||||
 | 
			
		||||
filehash=$(readlink -fn "$1" | md5sum | awk '{ print $1 }')
 | 
			
		||||
filedirectory="$edit_directory/$filehash/"
 | 
			
		||||
 | 
			
		||||
mkdir -p "$filedirectory"
 | 
			
		||||
 | 
			
		||||
basename=$(basename "$1")
 | 
			
		||||
filepath=$(realpath -s "$filedirectory/$basename")
 | 
			
		||||
 | 
			
		||||
user=$(id -un)
 | 
			
		||||
group=$(id -gn)
 | 
			
		||||
 | 
			
		||||
echo "Editing $1 in $filepath as $user:$group"
 | 
			
		||||
 | 
			
		||||
sudo test -e "$1" && (
 | 
			
		||||
    sudo cp -i "$1" "$filepath"
 | 
			
		||||
    sudo chown "$user":"$group" "$filepath"
 | 
			
		||||
) || (
 | 
			
		||||
    touch "$filepath"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
$EDITOR "$filepath"
 | 
			
		||||
 | 
			
		||||
sudo cp "$filepath" "$1"
 | 
			
		||||
 | 
			
		||||
rm "$filepath"
 | 
			
		||||
rm -rd "$filedirectory"
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue