3

I have a variable called instdir that has the current directory. I need to pass its value to a multiline string that will be written to a file. As instdir finishes with a slash I can't do anything like this:

cat > test <<EOF
  $instdir/final/path/to/file
EOF

But If I use $instdirfinal instead, it won't recognize the real instdir's value. What I suppose to do?

2 Answers 2

4

Here's the trick:

${instdir}final
Sign up to request clarification or add additional context in comments.

Comments

3
cat > test <<EOF
  ${instdir}final/path/to/file
EOF

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.