I often find myself wanting to move a file,then create a symlink where it was.In doing this by hand I tend to twist my mind.(Esp after doing half a dozen files)Use cases:Moving all my dot files to a folder so i can version control themMoving a file onto a faster disk (scratch) for High Performance ComputingIf there is not a single command, I would appreciate a fish script. (fish is not a POSIX shell, does not s pport the sh language)
Is there a command to move a file, and symlink it back to where it was?
symlink;fish
function lnmv    set dest_dir $argv[1]    set files $argv[2..-1]    for f in $files        set dest $dest_dir/$f        mv -- $f $dest        and ln -s -- $dest $f    endend