On Wed, Sep 27, 2017 at 9:05 PM, Michael <[email protected]> wrote:
>
> keybounceMBP:AdultSwim michael$ pushd "$(tmutil latestbackup)""$(/bin/ls -d 
> "$(find /Volumes/ -maxdepth 1 -type l -print)" | sed 
> 's/\/Volumes\///')""$(pwd -P)"
> -bash: pushd: /Volumes/TimeMachine/Backups.backupdb/Keybounces MacBook 
> Pro/2017-09-27-172133/New Main/Volumes/Kleiman Movies/Videos to 
> watch/TV/AdultSwim: No such file or directory
> keybounceMBP:AdultSwim michael$
>
> New Main/Volumes/ does not belong :_)

I get it now. If you're on the boot volume, you want to add that name
to the path. If you're on a different volume, you need to remove
"/Volumes".
The following should do that. It also uses pipes instead of slashes in
the sed commands; it reads better.

push \
"$(tmutil latestbackup)" \
"$(pwd -P | \
    sed \
    -e 's|/Volumes/|/|' \
    -e t \
    -e "s|^|"$(\
        find /Volumes/ -maxdepth 1 -type l | \
        sed 's|/Volumes/|/|')"|"\
)"

-e 's/Volumes/||' # remove the /Volumes prefix
-e t # if the previous replacement succeeded, stop processing
-e "s|^|… # find the likely boot volume name, remove "/Volumes/", and
add it to the beginning of the path


In one line:

pushd "$(tmutil latestbackup)""$(pwd -P | sed -e 's|/Volumes/|/|' -e t
-e "s|^|"$(find /Volumes/ -maxdepth 1 -type l | sed
's|/Volumes/|/|')"|")"


-- 
arno  s  hautala    /-|   [email protected]

pgp b2c9d448
_______________________________________________
MacOSX-talk mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/macosx-talk

Reply via email to