Good day, i write script for building gcc on linux, my code is:
#!/bin/bash
export INSTALLATION_GCC=/opt
cd $INSTALLATION_GCC
tar xjvf gcc-4.7.0.tar.bz2
export srcdir="$INSTALLATION_GCC/gcc-4.7.0"
export objdir="$INSTALLATION_GCC/gcc-bin"
export insdir="$INSTALLATION_GCC/usr/local"
mkdir -p $srcdir
mkdir -p $objdir
mkdir -p $insdir
cd $objdir
$srcdir/configure --prefix=$insdir
make bootstrap
make install
but when i run this script i get errors:
No such file or directoryopt
tar (child): gcc-4.7.0.tar.bz2\r: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
/configure: No such file or directory
'. Stop. No rule to make target `bootstrap
'. Stop. No rule to make target `install
Why cd not work successful, if i execute my script (if i input this command in interactive mode all ok)?After building and installing gcc why my version of gcc not changing, how can i replace old version gcc properly?
I think my comment about a backspace being part of the directory name is relevant:
“There is something strange here, the error message No such file or directoryopt is missing a space and a /. It looks to me like your code did not generate this error message, are you sure that $INSTALLATION_GCC is /opt with the leading /? It almost appears that the first character of $INSTALLATION_GCC is a backspace.”
I also spied
gcc-4.7.0.tar.bz2\rin one of the error messages. A\rwould give these effects. The most common unwanted source of\r(carriage-return) is Windows. Are you using something like Notepad on Windows to edit your scripts? If Windows is involved, convert your script usingdos2unix.