LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-13-2016, 02:44 PM   #1
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Rep: Reputation: 174Reputation: 174
Why is ~/ not the same as /home/user/ ?


I was creating a custom launcher on the Mate panel on CentOS 7. I created and placed my script in /home/ken. I pointed the launcher to ~/myscript.sh but it does not launch. I have tested the script from a terminal by typing ~/myscript.sh or /home/ken/myscript.sh or changing to the directory /home/ken and entering ./myscript.sh. All of these work. If I spell out the complete path in the launcher it also works. I am wondering why the launcher does not treat ~/ in the way that Unix and Linux have done for the past hundred year or so?

This also happens with Ubuntu Mate 14.04 and with gnome 2 on CentOS 6 so I do not think it is a Mate issue. Perhaps an artifact from gnome? Any ideas?

TIA,

Ken
 
Old 10-13-2016, 02:57 PM   #2
c0wb0y
Member
 
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 421

Rep: Reputation: 74
ls -l <the-script> ?
 
1 members found this post helpful.
Old 10-13-2016, 03:17 PM   #3
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
As far as I know - I've always had to call out the whole path in a "launcher" command (or setting the working directory). /home/user/blah.sh instead of ~/blah.sh BECAUSE the environment variable HOME (or current working directory) is not set in a launcher by default. You can probably see this by making a launcher with the command "/usr/bin/env > /home/user/env.out" and looking at the output to find the variables that are set. If HOME is not set correctly, then "~/" would not work.

Last edited by szboardstretcher; 10-13-2016 at 03:19 PM.
 
1 members found this post helpful.
Old 10-13-2016, 03:36 PM   #4
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Original Poster
Rep: Reputation: 174Reputation: 174
Thanks c0wb0y, I know the script is where it is supposed to be, is executable and works.
Code:
-rwxrwxr-x. 1 ken ken 19 Oct 13 15:30 test.sh
And thank you szboardstretcher, That makes sense. I generally would have put the script in a more public location if other users needed to access it and then addressed it by its full path. In this case the only users are me, myself and I So I decided to be lazy and use ~/

Ken
 
Old 10-13-2016, 03:45 PM   #5
c0wb0y
Member
 
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 421

Rep: Reputation: 74
glad you got it sorted.

Last edited by c0wb0y; 10-13-2016 at 03:47 PM.
 
  


Reply



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
[SOLVED] user somehow deleted /home/user and /home/user2 the_penguinator Slackware 3 06-17-2014 08:17 PM
[SOLVED] why chown user:group wildcard in path /home/user/.*/* will modify all /home owner cociugcristina Linux - Server 11 05-07-2013 04:16 AM
User does int getting home directory in root home in ubuntu 10.04 lucid lynx sunrised24 Linux - Server 2 03-07-2012 09:21 AM
[SOLVED] 'Could not chdir to home directory /home/[user]: Permission denied' arashi256 Linux - Newbie 25 11-11-2011 09:29 AM
[SOLVED] How can i change my HOME (/home/user) directory location to something else? QueenZ Linux - Newbie 6 08-05-2010 06:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:13 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
Open Source Consulting | Domain Registration