Questions tagged [readlink]

Use this tag for questions related to the readlink command which prints resolved symbolic links or canonical file names.

5
votes
2answers
70 views

How do I test for link to a link?

I want to test whether a file is a link to another link. I tried readlink but it doesn't work the way I need it: ralph@bash4.4.12,1:~/subdir1 $ ll lrwxrwxrwx 1 pi pi 13 Apr 10 14:34 hellolink ->...
2
votes
2answers
158 views

How to tell without knowing the mount point that a device UUID is mounted?

System: Linux Mint 19.1 Cinnamon 64-bit, based on Ubuntu 18.04 LTS. I would like to know if it is possible to get the following information: Is this UUID (of a block device) mounted or not? (without ...
2
votes
1answer
141 views

Overwrite symlink with original file

I have a directory with some symlink file, for example: /home/user/symlink/$(*symlink_file_name1*).mkv /home/user/symlink/$(*symlink_file_name2*).mkv And I have another directory with the original ...
0
votes
3answers
503 views

readlink -f doesn't work as expected

This is a script I'm writing for exercise. It should recursively find all regular files in the current directory's subtree and change the last modification date to yesterday date. #!/bin/bash ...
0
votes
2answers
275 views

Apply readlink to a non-symlink file?

The following code from https://stackoverflow.com/a/920834/156458is to get the pathname to the parent directory of a script inside the script, even if the script is run via a symlink to it: if [ -L ...
0
votes
1answer
41 views

How can I set ENV from a path

I just installed android-sdk using Homebrew. The path is /usr/local/Caskroom/android-sdk/3859397,26.0.1. I know I can export ANDROID_HOME with that value. How can I set it dynamically using the ...
6
votes
1answer
151 views

Looking for tested utility to get the absolute path to a relative symlink target

NB: In the original title of this post, I used the word standard in the everyday sense of "well-established" (and therefore time-tested, as a contrast to quick solutions I could roll myself). In the ...
1
vote
2answers
281 views

Trace route of a symbolic link

I want to resolve a symbolic link with the additional option to print the whole linkage. For example I want to run a command like readlink -f "symlink2" which reports each entry of the linkage. In ...
3
votes
3answers
489 views

Real current directory [duplicate]

Obviously I know about pwd and readlink, but is there a command to find out the real absolute path to the current directory (ie, resolving links and dots)?
1
vote
2answers
86 views

Get full directory of $file

My first shell script #!/bin/bash echo "Input your file" read $file path=(readlink -f $file) echo "$USER, $path" >> scriptlog.txt it said missing operand. How can I fix it?
1
vote
2answers
124 views

How do I keep command options from breaking other scripts executed within my command?

I have a bash shell script(my_script.sh) which runs a script(their_script) during execution. My script (my_script.sh) looks like this : THISDIR=`dirname $(readlink -f $0)` main() { cd $THISDIR ...
0
votes
1answer
2k views

sym link for android-studio/bin/studio.sh

I tried creating a symbolic link for android studio as such sudo ln -s android-studio/bin/studio.sh /usr/bin/asw I chose asw as the keyword to hopefully launch the executable studio.sh from anywhere ...
4
votes
2answers
12k views

explain the options of readlink command

Can someone please explain me following options of readlink command in simple language: -f, --canonicalize canonicalize by following every symlink in every component of the given ...