3 ms·
> Really? How often will I need to make a directory structure that is several levels deep, but only one directory at each level? Didn't take me long to find on
by mark-t 19y ago
> Really? How often will I need to make a directory structure that is several levels deep, but only one directory at each level?
Didn't take me long to find one in my scripts directory. Just imagine you're doing something similar by hand:
#!/bin/bash
# This script strips debugging symbols from programs and stores them separately.
# They will be loaded by gdb when needed but will not take up memory when
# running the program normally.
# determine where to save debugging symbols
DEBUG_PATH="/usr/lib/debug"
if [[ ${EUID} != 0 ]]; then
DEBUG_PATH="${HOME}/lib/debug";
fi
# go through list of command line arguments and split each one
for x in "$@"
do
echo "Splitting ${x}"
y="${DEBUG_PATH}${x}.debug"
mkdir -p "$(dirname $y)"
objcopy --only-keep-debug "${x}" "${y}" || continue
objcopy --add-gnu-debuglink="${y}" "${x}" || continue
chmod a-x,o-w "${y}"
strip "${x}"
done