LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-19-2020, 02:13 PM   #1
andrew.comly
Member
 
Registered: Dec 2012
Distribution: Trisquel-Mini 7.0, Lubuntu 14.04, Debian lxde 8.0
Posts: 308
Blog Entries: 2

Rep: Reputation: 16
Question loading variables error - bash: //: No such file or directory


In keeping a list of commands needed to restore an installation of my Trisquel Mini 8.0, I use variables to store common addresses, and to avoid duplicate work I keep all my variables for both restoring and backing up in one file "variables" stored in /usr/local/bin:
Code:
$ ls -l ..
total 48
drwxr-xr-x 11 a    adm  20480 May 19 10:30 bin
drwxr-xr-x  2 root root  4096 Apr 17  2018 etc
drwxr-xr-x  2 root root  4096 Apr 17  2018 games
drwxr-xr-x  2 root root  4096 Apr 17  2018 include
drwxr-xr-x  4 root root  4096 Apr 17  2018 lib
lrwxrwxrwx  1 root root     9 May 16 18:02 man -> share/man
drwxr-xr-x  2 root root  4096 Apr 17  2018 sbin
drwxr-xr-x 10 root root  4096 May 17 12:24 share
drwxr-xr-x  2 root root  4096 Apr 17  2018 src

$ ls -l variables 
-rwxrwxr-x 1 a adm 6874 May 18 18:11 variables
So recently during a restoration of my previous operating system along with many of the previous configurations I executed the following command:
Code:
sudo su
<<I entered in my psw>>
file="etc/xdg/lxsession/${lxSessionProfile}/autostart";
sudo echo "@xcompmgr -n -cfF -t-9 -l-11 -r9 -o.95 -D6 &" >> /${file}
and the pertinent contents of variables are:
Code:
#Session Profile
#	**Look in the folder /etc/xdg/lxsession/
		lxSessionProfile=Trisquel-mini
Unfortunately it seems that even though I had previously loaded my variables with the command:
Code:
. variables
but that was before I had logged in as su(root), so resultingly ${lxSessionProfile} wasn't already defined, and it seems that bash interpreted above cmd as:
Code:
sudo echo "@xcompmgr -n -cfF -t-9 -l-11 -r9 -o.95 -D6 &" >> /etc/xdg/lxsession//autostart
The unfortunate result is the mere annoyance of the following GARBLE whenever I loaded that file:
Code:
bash: //lx: No such file or directory
Is there any way to get rid of this garble?

Last edited by andrew.comly; 05-19-2020 at 02:27 PM. Reason: extra '/' in file defn
 
Old 05-19-2020, 02:22 PM   #2
shruggy
Member
 
Registered: Mar 2020
Posts: 994

Rep: Reputation: Disabled
There's something I don't understand. You command should have created a file named autostart in /etc/xdg/lxsession. It doesn't matter how many slashes you specify: for the shell /// is equal to /.

The bash error means there's a line //lx in one of your startup scripts: .profile, .bashrc, .bash_profile, /etc/profile, /etc/profile.d/*.sh, /etc/bash.bashrc, etc. Or in a file sourced from them.

Last edited by shruggy; 05-19-2020 at 02:41 PM.
 
1 members found this post helpful.
Old 05-19-2020, 02:39 PM   #3
andrew.comly
Member
 
Registered: Dec 2012
Distribution: Trisquel-Mini 7.0, Lubuntu 14.04, Debian lxde 8.0
Posts: 308

Original Poster
Blog Entries: 2

Rep: Reputation: 16
I should have thought of this earlier, but I ended up solving the problem with the following workaround:

I saved the file variables as another name, moved it to a sub-Directory, then copied that duplicate back to the same directory, combed through it for something of the like of "//lx:" finding nothing, saved and exited.
I then rebooted.
For some reason I don't get any such error message anymore.

What happened?

Last edited by andrew.comly; 05-19-2020 at 02:40 PM. Reason: grammar
 
Old 05-19-2020, 02:58 PM   #4
shruggy
Member
 
Registered: Mar 2020
Posts: 994

Rep: Reputation: Disabled
Quote:
Originally Posted by andrew.comly View Post
What happened?
No idea, but glad you sorted this out. Perhaps, the offending string was not in a file, but in an environment variable that got cleared on reboot?

Now, a bit nitpicking:
Code:
sudo echo "@xcompmgr -n -cfF -t-9 -l-11 -r9 -o.95 -D6 &" >> /${file}
sudo before echo is never needed. If you want to redirect output into a file only writable by root there are two possiblilities:
Code:
echo foo | sudo tee bar >/dev/null
Code:
sudo sh -c 'echo foo >bar'
 
1 members found this post helpful.
  


Reply

Tags
bash, configuration management, load, root, variable


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
apt-config:error while loading shared libraries: libgcc_s.so.1 cannot open shared object file: No such file or directory wenyumei Ubuntu 1 07-20-2016 10:58 AM
Bash to find all placeholder variables in a file and replace will real variables spadez Programming 6 11-26-2013 12:24 PM
[SOLVED] error: asm/ppc_asm.h: No such file or directory and error: asm/processor.h: No such f Thirupathip Linux - Newbie 3 01-25-2013 03:02 AM
windows eclipse platform - crt1.o: No such file: No such file or directory jnettleton Programming 2 05-18-2012 09:01 PM
Bash says "No such file or directory" but directory exists Fm3m Linux - General 7 10-28-2011 12:33 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration