Insert the current dir in a terminal command

For some reason, using blender from the command line requires the whole path (I tried using the relative path, but that doesn't work).
A blender command looks like this:

`blender -b /home/hanne/path-to-file/file.blend`

Is there a way to use the current folder in a command, something like:

blender -b $currenPath$/file.blend

I cd into the directory, then run. For example:

blender -b file.blend -x 1 -o //render -a

Run from terminal opened within the directory.

1 Like

Use $PWD, this is the current directory variable.

2 Likes

absolutely, either a single period .or $PWD represents your current directory :slight_smile:

so you could do:
blender -b ./file.blend
or
blender -b $PWD/file.blend

2 Likes

I can't get both to work, but maybe it's a flatpack issue?

flatpak run org.blender.Blender -b $PWD/teaser\ 01.blend -a
flatpak run org.blender.Blender -b ./teaser\ 01.blend -a

did you try putting quotation marks around it?

yknow, like this?:

flatpak run org.blender.Blender -b "./teaser 01.blend" -a
2 Likes

This doesn't work:

blender -b "./teaser 01.blend" -a
flatpak run org.blender.Blender -b "./teaser 01.blend" -a

But this works:

blender -b "$PWD/teaser 01.blend" -a
flatpak run org.blender.Blender -b "$PWD/teaser 01.blend" -a

Thanks!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.