.profile: Add replace function
This commit is contained in:
		
							
								
								
									
										9
									
								
								.profile
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								.profile
									
									
									
									
									
								
							@@ -234,6 +234,15 @@ if has ptgdp; then
 | 
			
		||||
		echo "$*" | ptgdp -p
 | 
			
		||||
	}
 | 
			
		||||
fi
 | 
			
		||||
if has sed && has find; then
 | 
			
		||||
	replace() {
 | 
			
		||||
		if [ $# -ne 2 ]; then
 | 
			
		||||
			echo "replace: Requires two arguments"
 | 
			
		||||
			return 1
 | 
			
		||||
		fi
 | 
			
		||||
		find . -type f -exec sed -i "s/$1/$2/g" {} \;
 | 
			
		||||
	}
 | 
			
		||||
fi
 | 
			
		||||
if has sudo; then
 | 
			
		||||
	case $_baseshell in
 | 
			
		||||
		*bash|*zsh)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user