Trying to execute the source command using "lfs" user on ubuntu 14.04 and getting this:
root@linux:~/lfs# su lfs - -c "source ~/.bash_profile" bash: cannot set terminal process group (-1): Inappropriate ioctl for device bash: no job control in this shell
Background info: I am following the LFS book, making a script out of it, so in my script which I execute with sudo, when it gets to this part, after creating the lfs user and his .bashrc and .bashprofile, I guess it is loading it.
echo "info: create 'lfs' group and user..." groupadd -f lfs id -u lfs &>/dev/null || useradd -s /bin/bash -g lfs -m -k /dev/null lfs passwd -d -q lfs echo "info: make 'lfs' own the 'tools' and 'sources' directories..." chown lfs $LFS/tools chown lfs $LFS/sources echo "info: creating a clean '.bash_profile' as user 'lfs'..." su lfs - -c "cat > ~/.bash_profile << \"EOF\" exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash EOF" echo "info: creating a clean '.bashrc' as user 'lfs'..." su lfs - -c "cat > ~/.bashrc << \"EOF\" set +h umask 022 LFS=/mnt/lfs LC_ALL=POSIX LFS_TGT=$(uname -m)-lfs-linux-gnu PATH=/tools/bin:/bin:/usr/bin export LFS LC_ALL LFS_TGT PATH EOF" su lfs - -c "source ~/.bash_profile"
It has been suggested that my syntax is incorrect, I am not at my linux machine at the moment, so will try to use different syntax when I get the chance. However, for info, I got the syntax from the answer here: https://serverfault.com/questions/411307/cannot-set-terminal-process-group-during-su-to-another-user-as-login-shell