#!/bin/bash ## fullnameNOSLASH -- forms the fully-qualified filename, and replaces SLASH with '[' -- by Eugene Reimer 2005-May; ## used, for example, in a script that makes backup copies under the /tmp directory, ## to allow for automated, or semi-automated, undoing... ## The transformation is reversible (fullnameRESLASH), provided you don't use square-brackets in your filenames:-) ## ## Copyright © 2005 Eugene Reimer; can be used, modified, copied, and distributed or sold under the terms of either the LGPL or the GPL (your choice); ## see http://www.gnu.org/licenses for the details of these terms. f="$1" [[ $f == /* ]] || f="$(pwd)/$f" ##form fully-qualified filename echo "$f" |sed "s|/|\[|g" ##echo full filename, but with SLASH-to-OPENBRACKET