mirror of
https://github.com/captn3m0/Scripts.git
synced 2024-09-27 22:22:53 +00:00
16 lines
279 B
Bash
Executable File
16 lines
279 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [[ ! $1 ]]; then
|
|
echo -e "Usage:\n\n\t$0 'file name'"
|
|
exit 1
|
|
fi
|
|
|
|
f=$(ls 2>/dev/null -l /proc/*/fd/* | fgrep "$1 (deleted" | awk '{print $9}')
|
|
|
|
if [[ $f ]]; then
|
|
echo "fd $f found..."
|
|
cp -v "$f" "$1"
|
|
else
|
|
echo >&2 "No fd found..."
|
|
exit 2
|
|
fi |