Tag Info

New answers tagged

1

There are heuristics that can help you, but there is no fully reliable way. Otheus shows how to use file descriptors. That's a nice heuristic, which works in most cases. However there are edge cases where it fails, and there's no way to detect failures. Example: take the following script. #!/bin/sh set lsof -p$$ | sed 's/[0-9][0-9]*//' Make two copies ...


3

I'm going to make a first-stage stab at this. Someone else will hopefully improve. Before executing your script, the shell will open a file-descriptor to the file. Usually this is assigned at fd 255. At any rate, if there's an open fd, then lsof can find it. So we use lsof -p $$ and get the highest-file-descriptor's filename. lsof won't work with every ...


1

These variables set the history to merge itself instead of overwrite, and not save duplicates: set history=1000 set histdup=erase set savehist=(1000 merge) the secret sauce is this line: alias precmd 'history -S; history -M' which will save and merge your history prior to printing the prompt - i.e. after each command you type. all of the above should ...



Top 50 recent answers are included