Improve scripts
This commit is contained in:
		
							parent
							
								
									f94f6a1c60
								
							
						
					
					
						commit
						b5764c0376
					
				
					 8 changed files with 28 additions and 16 deletions
				
			
		
							
								
								
									
										6
									
								
								.bin/.e
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								.bin/.e
									
										
									
									
									
								
							|  | @ -19,19 +19,19 @@ declare -A mapper=( | ||||||
| 	["zsh"]="$HOME/.config/zsh/.zshrc" | 	["zsh"]="$HOME/.config/zsh/.zshrc" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| if [[ -z "$1" ]] | if [ -z "$1" ] | ||||||
| then | then | ||||||
| 	echo "No argument given. Use --list (-l) to show all options." | 	echo "No argument given. Use --list (-l) to show all options." | ||||||
| 	exit | 	exit | ||||||
| fi | fi | ||||||
| if [[ "$1" == "-l" ]] || [[ "$1" == "--list" ]] | if [ "$1" = "-l" ] || [ "$1" = "--list" ] | ||||||
| then | then | ||||||
| 	echo "${!mapper[@]}" | 	echo "${!mapper[@]}" | ||||||
| 	exit | 	exit | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| target="${mapper["$1"]}" | target="${mapper["$1"]}" | ||||||
| if [[ -n "$target" ]] | if [ -n "$target" ] | ||||||
| then | then | ||||||
| 	$EDITOR "$target" | 	$EDITOR "$target" | ||||||
| else | else | ||||||
|  |  | ||||||
|  | @ -43,12 +43,22 @@ _autostart_manage_list () { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| _autostart_manage_info () { | _autostart_manage_info () { | ||||||
| 	mapfile -t autostart_units < <( _list ) | 	autostart_units=() | ||||||
|  | 	while IFS='' read -r line | ||||||
|  | 	do | ||||||
|  | 		autostart_units+=("$line") | ||||||
|  | 	done < <(_list) | ||||||
|  | 
 | ||||||
| 	_echo_table "${autostart_units[@]}" | column -t -s$'\t' | 	_echo_table "${autostart_units[@]}" | column -t -s$'\t' | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| _autostart_manage_enable_all () { | _autostart_manage_enable_all () { | ||||||
| 	mapfile -t autostart_units < <( _list ) | 	autostart_units=() | ||||||
|  | 	while IFS='' read -r line | ||||||
|  | 	do | ||||||
|  | 		autostart_units+=("$line") | ||||||
|  | 	done < <(_list) | ||||||
|  | 
 | ||||||
| 	for unit in "${autostart_units[@]}" | 	for unit in "${autostart_units[@]}" | ||||||
| 	do | 	do | ||||||
| 		_systemctl "$unit" add-wants autostart.target | 		_systemctl "$unit" add-wants autostart.target | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| #!/bin/bash | #!/usr/bin/env sh | ||||||
| set -e | set -e | ||||||
| 
 | 
 | ||||||
| path="/sys/class/backlight/intel_backlight" | path="/sys/class/backlight/intel_backlight" | ||||||
|  |  | ||||||
|  | @ -1,3 +1,3 @@ | ||||||
| #!/usr/bin/env bash | #!/usr/bin/env sh | ||||||
| 
 | 
 | ||||||
| gpg2 --output ${1%".gpg"} --decrypt $1 | gpg2 --output "${1%'.gpg'}" --decrypt "$1" | ||||||
|  |  | ||||||
|  | @ -1,3 +1,3 @@ | ||||||
| #!/usr/bin/env bash | #!/usr/bin/env sh | ||||||
| 
 | 
 | ||||||
| gpg2 --output $1.gpg --encrypt $1 | gpg2 --output "$1.gpg" --encrypt "$1" | ||||||
|  |  | ||||||
|  | @ -1,3 +1,5 @@ | ||||||
|  | #!/usr/bin/env sh | ||||||
|  | 
 | ||||||
| base_path="$HOME/.cache/remote-sources" | base_path="$HOME/.cache/remote-sources" | ||||||
| mkdir -p "$base_path" | mkdir -p "$base_path" | ||||||
| file_path="$base_path/$1" | file_path="$base_path/$1" | ||||||
|  | @ -7,5 +9,3 @@ then | ||||||
| 	curl -Ls -o "$file_path" "$2" | 	curl -Ls -o "$file_path" "$2" | ||||||
| fi | fi | ||||||
| source $file_path | source $file_path | ||||||
| 
 |  | ||||||
| # vim: ft=bash |  | ||||||
|  |  | ||||||
|  | @ -1,3 +1,4 @@ | ||||||
| #!/usr/bin/env bash | #!/usr/bin/env sh | ||||||
| 
 | 
 | ||||||
| vim $(find $@) | # shellcheck disable=SC2046 | ||||||
|  | vim $(find "$@") | ||||||
|  |  | ||||||
|  | @ -1,3 +1,4 @@ | ||||||
| #!/usr/bin/env bash | #!/usr/bin/env sh | ||||||
| 
 | 
 | ||||||
| vim $(grep $@) | # shellcheck disable=SC2046 | ||||||
|  | vim $(grep "$@") | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue