add newbash script
This commit is contained in:
		
							parent
							
								
									c45a40aabf
								
							
						
					
					
						commit
						42a9aefb94
					
				| 
						 | 
					@ -11,4 +11,5 @@ Useful utility scripts.
 | 
				
			||||||
| Script | Comment |
 | 
					| Script | Comment |
 | 
				
			||||||
|---|---|
 | 
					|---|---|
 | 
				
			||||||
|newsh ["command"]|Create executable `sh` script. Optionally add `command`.|
 | 
					|newsh ["command"]|Create executable `sh` script. Optionally add `command`.|
 | 
				
			||||||
 | 
					|newbash ["command"]|Create executable `bash` script. Optionally add `command`.|
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,14 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set -e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ -f "$1" ] ; then
 | 
				
			||||||
 | 
					  echo "Error: file exists: $1"
 | 
				
			||||||
 | 
					  exit 1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "#!/bin/bash" > "$1"
 | 
				
			||||||
 | 
					echo "" >> "$1"
 | 
				
			||||||
 | 
					echo "$2" >> "$1"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					chmod u+x "$1"
 | 
				
			||||||
		Loading…
	
		Reference in New Issue