Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 1
    To set the variable as environment variable (make it available to child processes), you may want to export it like export VIDFOLDER=/path/to/my/folder. Commented Sep 13, 2019 at 13:47
  • Uhmmm, i might have found the problem. I defined the environmental variable using quotes as in export VIDFOLDER="path/to/folder" problem is i have to escape a space in the path, does it work even without quotes? Commented Sep 13, 2019 at 13:52
  • 1
    why not just vidmv () { command mv "$@" /path/to/my/folder; } and let mv handle any missing or unreadable file errors? That also has the advantage of supporting all of the existing mv options (except -T which wouldn't work). Or vidmv () { command mv "$@" "$VIDFOLDER"; } allowing the OP to change the destination without redefining the function. Of course, VIDFOLDER would have to be pre-defined in the shell or .bashrc. Commented Sep 13, 2019 at 13:56
  • @WhiteEyeTree You need to escape the spaces: VIDFOLDER=temp/path\ with\ spaces/ and then you can ls -l "$VIDFOLDER" Commented Sep 13, 2019 at 14:10
  • 1
    or vidls () { ls "$@" "$VIDFOLDER" ; } :-) (I didn't use command here because people often have ls aliased to suit their output preferences. The "$@" in the function allows adding more ls options to those prefs.) Commented Sep 13, 2019 at 14:17