Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 1.26 KB

README.md

File metadata and controls

30 lines (25 loc) · 1.26 KB

Misc-Scripts

Miscellaneous scripts, tools, and aliases I use on my system (usually living in ~/bin).

Aliases are in aliases.md.

Each script/tool is provided in its own file with a README for usage and dependencies. All scripts are provided without any guarantee of functionality or safety -- read them before using, and run them on your system at your own risk. They are only built to run on UNIX environments.

Some scripts require the "-S" extension provided on FreeBSD since 6.0 and on coreutils since 8.30. To find all files relying on this extension, find and gawk.

find -type f -exec \
	gawk '/^#!\/usr\/bin\/env -S/ { print FILENAME }
		FNR == 1 { nextfile }' {} \+

To replace "/usr/bin/env" use find, gawk, xargs, and sed.

find -type f -exec \
	gawk -v ORS='\0' '/^#!\/usr\/bin\/env -S/ { print FILENAME }
		FNR == 1 { nextfile }' {} \+ | \
	xargs -0L 1 sed -i '1s:^#!/usr/bin/env:#!REPLACEMENT:'

The top-level "convert.bash" converts my system shebang to a more general "/usr/bin/env" launch. It requires find, gawk, and GNU xargs.