I’ve sometimes wished that the UNIX touch
command had the same -p option as mkdir
. With a little bit of scripting, it can:
#!/bin/sh mkdir="/bin/mkdir" touch="/usr/bin/touch" for arg in $*; do if [ "$arg" = "-p" ]; then opt_p=true continue fi if [ "$opt_p" = "true" ]; then $mkdir -p $(dirname $arg) && $touch $arg else $touch $arg fi done
Cool idea! I’ll try this out. Happy holidays!
Happy holidays to you too, Jud!
Pingback: Marc Abramowitz » Patch for GNU touch to add -p option, a la mkdir
Both BSD and GNU tail support a -F flag that effectively does the same thing — watch for a non-existent file.