Questions tagged [tilde-expansion]

Tilde expansion is a feature of the POSIX shell providing shortcut access to users' home directories.

Tilde expansion is a feature of POSIX shells providing shortcuts for the users' home directories:

~ # current user's home directory
~bob # home directory of the user named 'bob'
67 questions
0
votes
1 answer

How to perform tilde expansion for multiple paths set in an environment variable?

The following tilde expansion works as expected. $ A=~/foo.txt $ echo $A /home/lone/foo.txt In the following case, tilde expansion does not work because the tildes are within quotes. $ A="~/foo.txt ~/bar.txt" $ echo $A ~/foo.txt ~/bar.txt I know I…
Lone Learner
  • 18,088
  • 20
  • 102
  • 200
0
votes
1 answer

Taking relative command line arguments... In Java

No I don't mean relative to project or working directory. I mean that the following command java -jar myJar.jar ~/ should provide a string with "/home/user"... This doesnt seem to be working as expected. I am passing the argument in via eclipse's…
0
votes
0 answers

How can tilde expansion be used to get a full path from Bash variable that uses tilde to represent a path?

Let's say I have the following variable set: directoryTrash="~/trash" How can I use this variable to create the directory it describes? I've tried using it with mkdir in the following way: mkdir -p "${directoryTrash}" When I do this, the directory…
d3pd
  • 7,935
  • 24
  • 76
  • 127
0
votes
0 answers

Tilde(~) in nginx.conf for relative path

I want to use the tilde (~) to point to the /home/user directory as I want to have relative paths in production, but doesn't seem to work in nginx.conf file, although it works fine with .ini files. Also tried $HOME and $(HOME) location / { …
theblackpearl
  • 1,164
  • 3
  • 15
  • 34
0
votes
1 answer

Tilde prefix returns invalid home directory

I am trying to find the home directory of users on a UNIX (Solaris/AIX) box using echo ~username This does return the home directory for all valid users. For some reason this command also outputs home directory which are non-existent for few users…
thinkster
  • 586
  • 2
  • 5
  • 19
0
votes
2 answers

Cannot create directory with tilde

Given this script # cat foo.sh echo $HOME set -x mkdir ~ I am getting this result # ./foo.sh /home/Steven Penny ++ mkdir '' mkdir: cannot create directory `': No such file or directory If I run mkdir "$HOME" I have no problem. I think the issue is…
Zombo
  • 1
  • 62
  • 391
  • 407
0
votes
1 answer

How to search in fields delimited by the tilde character

I have a field in the database separated by tilde ~ I can't figure out how to search in the field with a mssql query. Ex select * from table where john in repnames Data is in the field like tom~john~max I've tried a few searches on Google but…
Kurt
  • 3
  • 1
  • 4
1 2 3 4
5