LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-30-2013, 06:12 PM   #1
WildDrake!
Member
 
Registered: Dec 2003
Location: Current Location: Colorado
Distribution: Ubuntu 14.10, Mint 17.1 Cinnamon and Mate
Posts: 99

Rep: Reputation: 15
Smile Why doesn't " . /home/<user>/.peekaboo" execute?


Ubuntu 12.04 .peekaboo is a bash shell script I wrote which I wanted to be launched by the gui Startup Applications service after login...but it's not launching it. My statement for the path in StartUp is:

Code:
/home/justme/.peekaboo
I must be having a very blond moment-

Code:
justme@ispy:~$ cd
justme@ispy:~$ ./.peekaboo
THIS WORKS!

justme@ispy:~$ . .peekaboo
THIS WORKS!
-however-

Code:
justme@ispy:~$ cd
justme@ispy:~$ ls .peekaboo
.peekaboo
justme@ispy:~$ pwd
/home/justme
justme@ispy:~$ ./home/justme/.peekaboo
bash: ./home/justme/.peekaboo: No such file or directory
justme@ispy:~$
Why doesn't "./home/justme/.peekaboo" execute on the command line?

If I put .peekaboo further into the file system's tree, for instance:

Code:
/home/justme/0--Scripts/bash/.peekaboo
I can execute .peekaboo either at the commandline or from the gui Startup Applications sercive using the above path! There has to be something VERY BASIC missing in my understanding here...What's so different about my home directory???

Thanks for your thoughts!
 
Old 08-30-2013, 06:21 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 3,879
Blog Entries: 1

Rep: Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998
Sounds like it is not executable. Some of your other examples are not valid paths so they don't count.

What does ls -l .peekaboo say?

Do this:

Code:
cd (will put you in your home directory)

chmod +x .peekaboo

./.peekaboo
Code:
. .peekaboo - This sources the file, so it does not have to be executable, it works

./home/justme/.peekaboo - Not a valid path unless /home/justme/home/justme/.peekaboo exists!
 
Old 08-30-2013, 06:34 PM   #3
WildDrake!
Member
 
Registered: Dec 2003
Location: Current Location: Colorado
Distribution: Ubuntu 14.10, Mint 17.1 Cinnamon and Mate
Posts: 99

Original Poster
Rep: Reputation: 15
Code:
justme@ispy:~$ ls -l .peekaboo
-rwxrwxr-x 1 justme justme 1663 Aug 30 12:08 .peekaboo
justme@ispy:~$
Looks like it is already executable to me, or am I reading it wrong?

Quote:
./home/justme/.peekaboo - Not a valid path unless /home/justme/home/justme/.peekaboo exists!
I don't understand that statement at all. I thought /home/justme/.peekaboo is the absolute path from the beginning of the linux file system. Why would such a thing need to be corrected by writing it as /home/justme/home/justme/.peekaboo in order to launch the script???
 
Old 08-30-2013, 06:38 PM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,602

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
You have the answer ...

Code:
justme@ispy:~$ pwd
/home/justme
justme@ispy:~$ ./home/justme/.peekaboo
bash: ./home/justme/.peekaboo: No such file or directory
If your current working directory is /home/justme, and the file is in /home/justme/.peekabo...

Then ./home/justme/.peekaboo will not work as that is the wrong path...

use "./.peekaboo"... Your leading "." tells the shell to look in the current directory. So the path "./home/justme/.peekaboo" says, "look in the current directory (the leading ".") for the directory home, and look in the directory home for the directory justme, and then look in the directory justme for the file ./peekaboo".

I'm betting there is no directory called "home" in your home directory...
 
Old 08-30-2013, 06:43 PM   #5
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 3,879
Blog Entries: 1

Rep: Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998
Quote:
Originally Posted by WildDrake! View Post
Code:
justme@ispy:~$ ls -l .peekaboo
-rwxrwxr-x 1 justme justme 1663 Aug 30 12:08 .peekaboo
justme@ispy:~$
Looks like it is already executable to me, or am I reading it wrong?
Then ./.peekaboo should work, can you verify that again...

Quote:
Originally Posted by WildDrake! View Post
I don't understand that statement at all. I thought /home/justme/.peekaboo is the absolute path from the beginning of the linux file system. Why would such a thing need to be corrected by writing it as /home/justme/home/justme/.peekaboo in order to launch the script???
/home/justme/.peekaboo is the absolute path, but you had ./home/justme/.peekaboo which is current-directory-plus-/home/justme/.peekaboo
 
Old 08-30-2013, 06:50 PM   #6
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
As the others have said, "." is an alias to your current directory. So "./home/justme/.peekaboo" is expanding to "/home/justme/home/justme/.peekaboo".

You use the "." when providing the relative path to the executable. You leave the "." off when providing the absolute path.
 
Old 08-30-2013, 06:54 PM   #7
WildDrake!
Member
 
Registered: Dec 2003
Location: Current Location: Colorado
Distribution: Ubuntu 14.10, Mint 17.1 Cinnamon and Mate
Posts: 99

Original Poster
Rep: Reputation: 15
./.peekaboo Has always worked from the commandline from the beginning, as I was setting in the user directory.

I was trying to get the gui StartUp Applications service to launch it, by using /home/<user>/.peekaboo
On my desktop, where I wrote the program, StartUp does indeed launch it with that path. However, on my laptop, using that same path with the user name switched, it does not launch it. Which is why I started testing the path I was using in the Console to see what was wrong.

What path should I be putting in the StartUp Applications in order to lauch this script? As I said, on my Desktop machine, /home/justme/.peekaboo works, but this path format doesn't work on the laptop!!! My eyes are crossed as to why! (Both are ubuntu 12.04)

I am going to be gone for awhile, should you reply right away...

I appreciate your help! Obviously, I need to read something on this to straighten out my understanding. But I am not sure what.
 
Old 08-30-2013, 07:03 PM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,602

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
The best path would be /home/justme/.peekaboo

Which is likely what you tried the first time as a different user. At that point you have to see what the access controls are on the directory justme and the file .peekaboo. Very likely the other user can't access it.
 
Old 08-30-2013, 07:06 PM   #9
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 3,879
Blog Entries: 1

Rep: Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998
I think that some of your confusion results from not understanding the two possible meanings of a leading '.'.

You originally indicated that . ./.peekaboo worked, but then you added a leading '.' without spaces to the path, which said the file did not exist.

These are actually two distinct and different cases.

First, anytime you prefix a path with a '.' (without intervening spaces), the shell expands that to mean CWD+your/path.

The second case, '.' as the first command line argument, followed by whitespace and a path is an alias for source, and means to evaluate the following path/filename as shell script.

Code:
man bash

SHELL BUILTIN COMMANDS
            ...
        .  filename [arguments]
       source filename [arguments]
              Read and execute commands from filename in the current shell environment and return the exit sta-
              tus of the last command executed from filename.  If filename does not contain a slash, file names
              in  PATH  are used to find the directory containing filename.  The file searched for in PATH need
              not be executable.  When bash is not in posix mode, the current directory is searched if no  file
              is  found in PATH.  If the sourcepath option to the shopt builtin command is turned off, the PATH
              is not searched.  If any arguments are supplied, they become the positional parameters when file-
              name  is  executed.  Otherwise the positional parameters are unchanged.  The return status is the
              status of the last command exited within the script (0 if no commands are executed), and false if
              filename is not found or cannot be read.
The single '.' notation is mostly useful inside other scripts but can be visually confusing if mistaken for the '.' globbing operator and interpreted as CWD.

Last edited by astrogeek; 08-30-2013 at 07:07 PM.
 
Old 08-30-2013, 07:15 PM   #10
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 3,879
Blog Entries: 1

Rep: Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998
Quote:
Originally Posted by WildDrake! View Post
What path should I be putting in the StartUp Applications in order to lauch this script? As I said, on my Desktop machine, /home/justme/.peekaboo works, but this path format doesn't work on the laptop!!! My eyes are crossed as to why! (Both are ubuntu 12.04)
That same path should work on either (with suitable user name changed if necessary).

If it doesn't seem to work, first make sure the script is executable and owned by the user on the target machine. Run it from a shell as that user just to confirm that.

Then using the absolute path /home/user/.peekaboo in that user's GUI startup script should work.

I suspect the cross-eyed syndrome has tricked you, I suffer from that myself on occassion!
 
Old 09-01-2013, 05:55 PM   #11
WildDrake!
Member
 
Registered: Dec 2003
Location: Current Location: Colorado
Distribution: Ubuntu 14.10, Mint 17.1 Cinnamon and Mate
Posts: 99

Original Poster
Rep: Reputation: 15
Thanks for straightening me out on Absolute, Relative, and Sourcing. I was trying so many different things on the command line trying to figure out what was wrong I confused myself on that.

OK. On the Laptop, which is where I have installed .peekaboo, in a Terminal I can say

Code:
kate@roadtrip:~$ ls -la .peekaboo
-rwxrwxr-x 1 kate kate 1663 Aug 30 12:08 .peekaboo
kate@roadtrip:~$
Then I can run the script by giving the Absolute path as so:
Code:
/home/kate/.peekaboo
And it executes perfectly!

However, I then paste the same statement into the laptop's Gui Startup. Reboot the laptop. Nothing happens! (Niether does it work in crontab if I set up a @reboot command.)

I should mention, .peekaboo uses the Network. Could it be that the laptop is so much faster than my desktop that the network is not in place when the user's Startup facility launches it's stuff???
 
Old 09-01-2013, 07:37 PM   #12
WildDrake!
Member
 
Registered: Dec 2003
Location: Current Location: Colorado
Distribution: Ubuntu 14.10, Mint 17.1 Cinnamon and Mate
Posts: 99

Original Poster
Rep: Reputation: 15
I forgot to add this to my last message...

I created a launcher on the classic gnome launch bar. Gave it a path of /home/kate/.peekaboo Saved it. And then clicked the icon. It worked great! So, why not automatically at login from the Startup Applications section???
 
Old 09-02-2013, 05:49 PM   #13
WildDrake!
Member
 
Registered: Dec 2003
Location: Current Location: Colorado
Distribution: Ubuntu 14.10, Mint 17.1 Cinnamon and Mate
Posts: 99

Original Poster
Rep: Reputation: 15
Solved!

There was something wrong with the text of the file ".config/autostart/peekaboo" from which Startup Applications gets it's information to launch stuff at login. I don't know what that problem was, but I originally created that file manually using ssh. I used the gui of Startup Applications to both remove and re-create the text file, and it just worked after that. Kinda like magic! But I didn't see any elvs hangin around the laptop....

Thanks for all your help and putting Absolute, Relative and Sourcing back into their proper focus...
I hope your days are going great!
 
Old 09-03-2013, 02:54 PM   #14
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 3,879
Blog Entries: 1

Rep: Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998
Quote:
Originally Posted by WildDrake! View Post
Solved!

There was something wrong with the text of the file ".config/autostart/peekaboo" from which Startup Applications gets it's information to launch stuff at login. I don't know what that problem was, but I originally created that file manually using ssh. I used the gui of Startup Applications to both remove and re-create the text file, and it just worked after that. Kinda like magic! But I didn't see any elvs hangin around the laptop....

Thanks for all your help and putting Absolute, Relative and Sourcing back into their proper focus...
I hope your days are going great!
Sorry for the absence the past few days - very limited availability...

Glad you got it sorted! I had begun to suspect a problem with the start script - wasn't much else!

Good luck!
 
  


Reply


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
need the result to execute the command "mv /root /home/admin/" mahbabu999 Linux - Server 3 01-29-2013 02:51 PM
NFS problem: "Could not chdir to home directory /home/USER: Permission denied" sumanc Linux - Server 4 07-22-2010 05:12 PM
[SOLVED] Adding user "me" to group "you" doesn't take effect for a while. Why not? Le Beastie Linux - Newbie 1 12-09-2009 05:13 AM
[SOLVED] how to simulate "mkdir -p /home/blah1/blah2/blah3" in "c" where only /home exist platinumedge Linux - Newbie 4 10-04-2009 07:28 PM
Ordinary user can execute the "halt" command ederts Linux - Newbie 7 05-24-2001 12:18 PM


All times are GMT -5. The time now is 08:38 AM.

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