0

Suppose that I am in a folder ~/top. There is a file path like this: ~/top/middle/bottom folder.

I want to define a local macro and then use it in the file path.

What I have done is the following:

local target ""bottom folder""
cd "middle"
cd `target'

This works fine but I can't figure out how to combine lines two and three into a single line.

I have tried cd "middle/`target'" andcd ""middle/"+`target'" but these are wrong.

TCW
  • 25
  • 9

1 Answers1

2

Assuming you are already in the directory top, the following should work:

local target bottom folder
cd "middle/`target'"
  • Brilliant, thanks. I guess I should just avoid this in the future by omitting spaces from my folder and file names! – TCW Jun 19 '18 at 20:57
  • 4
    The problem was that you were using two sets of quotes in `local`. You only needed one or none at all. –  Jun 19 '18 at 20:59