tilde-expansion

How to replace the home directory with a tilde? Linux

可紊 提交于 2019-12-11 20:08:10
问题 I'm currently making a shell in C++ and I've been able to output the absolute directory as the prompt with getcwd(), however when the user reaches the home directory I would like to output a tilde instead of the home directory. So for example instead of [bb@bbmachine bb] I would like to output [bb@bbmachine ~] How would I do something like that? 回答1: Read first about globbing, notably glob(7). For the expansion of path starting with tilde ~ consider wordexp(3) and glob(3). For showing a path

Tilde Expansion Doesn't Work in Docker COPY Command

为君一笑 提交于 2019-12-09 03:06:38
问题 I have a Dockerfile with the following line: COPY *.zip ~user1 The user user1 already exists and has a home directory (i.e. /home/user1 ). The goal, of course, is to copy the zip file into that user's home dir, however the result of the above is that the zip file is copied to a file named literally /~user1 in the image. The following does work as expected: COPY *.zip /home/user1 Is this a bug in Docker or is there a limitation related to tilde expansion that I'm not aware of? Using Docker 1

Tilde “~” expression not functioning in “R”?

青春壹個敷衍的年華 提交于 2019-12-07 18:20:02
问题 The tilde expression is not working on my RStudio! I am using a windows 10 OS. Update : After looking more carefully(thanks to Dason) It seems the "~" is pointing to "user/Documents/" rather then "user/". is there any work around? Any help? 回答1: The home directory in Windows R is set using the environment variable R_USER Set this using Windows (search from the Start Menu for "environment variable"). Whatever you set this to will become what R uses for ~ . I have mine set to C:\Users\trehman\R

How can I make Perl recognize paths with '~'?

被刻印的时光 ゝ 提交于 2019-12-07 05:51:19
问题 Possible Duplicate: How do I find a user's home directory in Perl? I'm running Ubuntu. Whenever I pass a Perl script a path that starts with ~ (e.g. ~/Documents/file.txt ) it fails finding it. I must pass the canonical path (e.g. /home/dave/Documents/file.txt ). Why is that? Can I make Perl recognize ~ paths? UPDATE All the suggested solutions include changing the code in the scripts. I would like for a solution that would not involve any changes to the scripts themselves (since not all of

Tilde “~” expression not functioning in “R”?

别等时光非礼了梦想. 提交于 2019-12-05 20:47:24
The tilde expression is not working on my RStudio! I am using a windows 10 OS. Update : After looking more carefully(thanks to Dason) It seems the "~" is pointing to "user/Documents/" rather then "user/". is there any work around? Any help? The home directory in Windows R is set using the environment variable R_USER Set this using Windows (search from the Start Menu for "environment variable"). Whatever you set this to will become what R uses for ~ . I have mine set to C:\Users\trehman\R . Here is how mine looks. As you found out yourself, R's ~ points to your documents folder. An easy way to

How can I make Perl recognize paths with '~'?

我的梦境 提交于 2019-12-05 08:25:44
Possible Duplicate: How do I find a user's home directory in Perl? I'm running Ubuntu. Whenever I pass a Perl script a path that starts with ~ (e.g. ~/Documents/file.txt ) it fails finding it. I must pass the canonical path (e.g. /home/dave/Documents/file.txt ). Why is that? Can I make Perl recognize ~ paths? UPDATE All the suggested solutions include changing the code in the scripts. I would like for a solution that would not involve any changes to the scripts themselves (since not all of them are mine). Perhaps something in the way Bash works? The updated version of the question was posted

Swift: How to expand a tilde in a path String

只愿长相守 提交于 2019-12-04 02:45:50
How can I expand a path String with a tilde in Swift? I have a string like "~/Desktop" and I'd like to use this path with the NSFileManager methods, which requires the tilde to be expanded to "/Users/<myuser>/Desktop" . (This question with a clear problem statement doesn't exist yet, this should be easily findable. Some similar but not satisfying questions are Can not make path to the file in Swift , Simple way to read local file using Swift? , Tilde-based Paths in Objective-C ) Tilde expansion Swift 1 "~/Desktop".stringByExpandingTildeInPath Swift 2 NSString(string: "~/Desktop")

Tilde Expansion Doesn't Work in Docker COPY Command

风流意气都作罢 提交于 2019-12-01 03:43:10
I have a Dockerfile with the following line: COPY *.zip ~user1 The user user1 already exists and has a home directory (i.e. /home/user1 ). The goal, of course, is to copy the zip file into that user's home dir, however the result of the above is that the zip file is copied to a file named literally /~user1 in the image. The following does work as expected: COPY *.zip /home/user1 Is this a bug in Docker or is there a limitation related to tilde expansion that I'm not aware of? Using Docker 1.13.0 on Mac. Tilde expansion for COPY is not supported. From The COPY docs : The dest is an absolute

Tilde-based Paths in Objective-C

僤鯓⒐⒋嵵緔 提交于 2019-11-30 23:05:31
In Objective-C, how do I go about converting tilde-based pathnames to full pathnames? That is, I'd like to convert from ~/sandbox to /Users/TheBobs/sandbox . Ben S Use NSString's stringByExpandingTildeInPath: method. There are also several other methods that make it easy to work with paths . 来源: https://stackoverflow.com/questions/1675852/tilde-based-paths-in-objective-c

Tilde-based Paths in Objective-C

倖福魔咒の 提交于 2019-11-30 17:50:58
问题 In Objective-C, how do I go about converting tilde-based pathnames to full pathnames? That is, I'd like to convert from ~/sandbox to /Users/TheBobs/sandbox . 回答1: Use NSString's stringByExpandingTildeInPath: method. There are also several other methods that make it easy to work with paths. 来源: https://stackoverflow.com/questions/1675852/tilde-based-paths-in-objective-c