0

When building gcc-4.8.1, I met a cp command as following:

#!/bin/sh
set -x
fname="cp.sh"
cp -v $fname.{,.bk}

It will occurs error when execute this script:

  <29>pli[1050]@~/workspace/shell*0 > sh cp.sh
  + fname=cp.sh
  + cp -v cp.sh{,.bk}
  cp: missing destination file operand after âcp.sh{,.bk}â
  Try 'cp --help' for more information.
  <30>pli[1051]@~/workspace/shell*0 >

But when type it on cmd line directly, it works well as expected. It is very in comprehensive to me.\n

  <28>pli[1049]@~/workspace/shell*0 > cp -v cp.sh{,.bk}
  cp.sh -> cp.sh.bk
  <29>pli[1050]@~/workspace/shell*0 > ^C
5
  • 1
    Try using bash instead of sh. I think I've had this issue before, and doing that solved it. Commented Jan 13, 2014 at 2:18
  • It works, thanks a lot. sh -> dash by default. Commented Jan 13, 2014 at 2:21
  • Make sure you're building outside of the src folder. I suggest you read through the LFS especially the sections on gcc. Commented Jan 13, 2014 at 2:22
  • Yes. I built gcc follow the steps of LFS 7.4 chapt5, and build mkdir outside of src folder. Commented Jan 13, 2014 at 2:28
  • If you prefer bash over dash, on Debian you can do dpkg-reconfigure dash and set bash as default shell. Any "performance" benefits using dash are negligible in my opinion. Commented Jan 13, 2014 at 5:14

1 Answer 1

1

You need to build gcc with "bash". On Ubuntu derived distributions "/bin/sh" in not linked to "/bin/bash" (but to "/bin/dash"); this is documented in the Ubuntu wiki here. I would suggest using a "ppa" if possible.

Sign up to request clarification or add additional context in comments.

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.