- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Tilde AND variable translations (ie ~$user)
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 06:54 AM
тАО09-10-2002 06:54 AM
Tilde AND variable translations (ie ~$user)
$ user=lzc
$ ll -d ~$user
drwxrwx--- 18 lzc 100 4096 Sep 10 10:51 /mnt/lzc
$ export user
$ ksh
$ ll -d ~$user
~lzc not found
$ sh
$ ll -d ~$user
drwxrwx--- 18 lzc 100 4096 Sep 10 10:51 /mnt/lzc
$ ksh
$ ll -d ~$user
~lzc not found
$ ll -d ~lzc
drwxrwx--- 18 lzc 100 4096 Sep 10 10:51 /mnt/lzc
$ sh
$ ll -d ~$user
drwxrwx--- 18 lzc 100 4096 Sep 10 10:51 /mnt/lzc
Obviously, ksh can handle ~$user. Is there any way around this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 06:58 AM
тАО09-10-2002 06:58 AM
Re: Tilde AND variable translations (ie ~$user)
eval ll -d ~$user
This would force ksh to expand $user first, then execute "~" on it.
my 2 cents...
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 07:31 AM
тАО09-10-2002 07:31 AM
Re: Tilde AND variable translations (ie ~$user)
But, I don't like it :(
If it works with sh it should also work with ksh.
BTW, I am experiencing difficulties when assigning points. I click on the drop down list and make my selections then I click submit and I DO get the acknowledgments. But when I click to go back to the message the points disappear.
Please assist.
Thanks
lzc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 08:16 AM
тАО09-10-2002 08:16 AM
Re: Tilde AND variable translations (ie ~$user)
ll -d $HOME/$user
Different shells, different ways of doing things.
HTH
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 08:23 AM
тАО09-10-2002 08:23 AM
Re: Tilde AND variable translations (ie ~$user)
This just will not work. Say user=lzc and I am logged in as emp:
echo ~
gives you /mnt/emp
echo $HOME
also gives you /mnt/emp
what will echo $HOME/$user do ;)
Though eval does it I am Still looking.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 08:25 AM
тАО09-10-2002 08:25 AM
Re: Tilde AND variable translations (ie ~$user)
$HOME is relative to the current running session, not the one used by $user.
If henry ran the script with user=susan, you would get - /home/henry/susan
...
It is too bad that they don't behave the same. ksh for the most part can be a superset of sh, but it looks like you found the exception.
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 08:34 AM
тАО09-10-2002 08:34 AM
Re: Tilde AND variable translations (ie ~$user)
I meant
/home/$user
or wherever your user's home directories are...
Tom