Miscellaneous short shell utilities I use frequently
Inject or steal jobserver tokens from GNU make. Useful for when you want to
increment or decrement the -j
setting on a long-running parallel make
.
Expect make
to emit warnings such as the following after using this:
make: INTERNAL: Exiting with 7 jobserver tokens available; should be 5!
Copy or move a file, and also move the vim
undofile. Assumes all undofiles
are kept in ~/.vim/undo
. Currently, it only moves one file at a time, it
requires absolute paths, and it requires the second argument to be the filename
and not just the target directory. It won't do the right thing if you only
specify the target directory.
BUG: Should be more robust, and should at least complain instead of doing the wrong thing.
Like vim-cp
and vim-mv
, but also renames it in git.
Compare two files, and ask if you want to delete the first if the two are identical.
Compare two files, and ask if you want to replace the first with a symlink to the second if the two are identical.
Returns success if two files are the same inode, and otherwise returns failure.
BUG: Doesn't make sure the files are actually on the same device.
For each specified swap device, or, if none are specified on the command line,
for each swap device in /proc/swaps, calls swapoff
and then swapon
. Useful
for loading swapped-out pages back into RAM after recovering from a low-memory
condition.
Filter a list of filenames, removing files with content identical to a file already seen.
Uses newline as delimiter. Will choke on filenames containing newlines.