General :: Forcing An Absolute Path Where A Relative Path Is Expected

Feb 21, 2011

I have a program that takes a relative path as input appends it to a some path string to get the actual path.

Now all I can input is the relative path. So if I want to go one level above my input will be ../mypath.

If I know the depth of the path used internally, I can use .. as many times to go to the root directory and then give the absolute path. But suppose I do not know the depth of the directory, can I construct a relative path string such that it considers it as a relative path. One way could be to have enough .. in the path string so that I can force an absolute path for some maximum depth of path.

Is there some path string syntax that I am not aware of but can achieve this?

View 2 Replies


General :: Change Absolute Path To Relative Path?

May 31, 2011

Current script:-

find . -depth -type d -name .git -printf '%h�' | while read -d "" path ; do (
cd "$path" || exit $?


How shall i go about changing the absolute path to relative path, so that /home/git/mirror/android/adb/ndk.git gets converted to /mirror/android/adb/ndk.git //echo <command> "$prefix$PWD.git" ?? - anything for relative path?

View 7 Replies View Related

Programming :: Java Applet Not Loading Image With Relative Path But With Absolute Path / Resolve It?

Jul 17, 2009

Java applet not loading image with relative path(e.g. images/1.jpg) but loads image with absolute path(i.e. from /root/user/images/1.jpg) . This is a problem when i want to host the applet on web server

View 2 Replies View Related

General :: Command Line - Get Relative Path From Two Absolute Paths In Shell?

May 13, 2010

We have two paths. First one is directory, second either dir or file.

/a/b/c and /a/d/e.txt

Relative path from first path to second will be: ../../d/e.txt

How to get it in linux terminal?

PS: For those who ask "what is use case?" - creating lots of relative symlinks (just as an example)

View 1 Replies View Related

Programming :: Can I Get Absolute Path Without Giving A "path" But Inode Number By C

Aug 13, 2010

Does anyone know how to get the path with a inode number by C programming?
Or can I get the absolute path without giving a "path" but a inode number by C?

like this: get_path(unsigned inode);
not such this function: getcwd(".", xxx);

View 7 Replies View Related

General :: Make Rsync To Use Relative Path?

Sep 6, 2011

I want to sync remote database copy using command

As it's result command creates file /backup/snapshots/backup/databases/mysql.sql. How can I force it to put file in /backup/snapshots/mysql.sql? It's mandatory that source must be remote (it's part of more complex script).

View 1 Replies View Related

General :: Difference Between PATH=$PATH:$1 & PATH=$1:$PATH?

Jan 16, 2011

I found the following function in /etc/profile file.


1. I dont undestand what "if ! echo $PATH | /bin/grep -qE "(^|:)$1($|:)"" this if statement actually comapres??

2. Also what is the difference between PATH=$PATH:$1 & PATH=$1:$PATH

View 14 Replies View Related

Programming :: Reading The Absolute File-path As Sorted?

Jun 13, 2010

I wanted to read out the absolute file-path (filename) as sorted in a folder (on Linux). The reading the file-paths is ok but I have problems in sorting.


selectedDirectory = fl_dir_chooser ("Select Imagedirectory:",NULL,0); //This is just a widget to show the folder.
DIR *d;
dirent *de;


The files -105.dcm, -106.dcm, -107.dcm lie in the folder at the bottom and -36.dcm, -37.dcm- at the top. The program compares 1 and 3 of 105 and 37, 1 is lesser than 3, then prints out first, but does not know that 105 is three digits and 37 is two digits.

View 1 Replies View Related

Ubuntu :: Sudo Does Not Preserve PATH As Expected?

Jun 11, 2010

I'm attempting to add a directory to PATH so it's available when I sudo. (I do not want to sudo -i), but it's not behaving as I expect.I've added a line to add the directory to PATH in all of these files:



View 4 Replies View Related

General :: Move A File To Some Path And Create That Path When It Doesn't Exist?

Oct 8, 2010

I use this command:


find ./ -atime +360

to figure out the files that haven't been accessed since 360 days. The command above will return results like this:


... etc

I'm taking here about tins of directories, thousands of files. I'm looking to find a command that makes me able to move the results above to another path, and to create that path once it doesn't exist like below:


mv /uploads/2010/02/some-file-name.ext /old-files/uploads/2010/02/some-file-name.ext

But I want the executed command to create this path



If it doesn't exist.

View 6 Replies View Related

General :: Deleted Path Variable - How To Return To The Original Path Value

Apr 26, 2011

Experimenting with shell variables, accidentally deleted the path variable how could I return to the original path value. What kinds of problems will I have if I don't have a path variable.

View 3 Replies View Related

General :: Change Windows Path To Unix Path?

Sep 14, 2009

I have a path c:windowsackup I need this string to be changed into /windows/back/up I used the command -bash-3.00$ echo windackup | sed 's/\//g' but the output is windbackup

View 7 Replies View Related

Red Hat / Fedora :: Appending A Path To PATH Variable Permanently?

Oct 21, 2010

how to add a path to PATH variable permanently so that it remains persisent even after closing shell and rebooting the system when i added a path, to variable it remained there as long as i didn't closed the shell. but when i reopened it ,changed were undone.

View 2 Replies View Related

SUSE / Novell :: Add Path To $PATH Variable?

Apr 19, 2009

I am trying to figure out how i can add the path /usr/sbin/ into the $PATH variable. I want this to be used from the normal account. I am bored settinh this manualy each time my computer starts.

View 2 Replies View Related

General :: Command Path Is In PATH But Bash Does Not Find The Command

Jul 12, 2011

kernel, slackware 12.0
GNU bash 3.1.17


As you can see, /usr/local/bin is in the path. However, bash does not look for nasm in /usr/local/bin.

If I am root, things go well:


View 16 Replies View Related

Fedora :: Add Path In .bashrc By Commenting Out Old Path And Adding New One - Command Source ~/bashrc

Jun 14, 2011

When I add some path in .bashrc by commenting out old path and adding new one like this:

#EXPORT HOME_PLAY=/home/gem/old_play
EXPORT HOME_PLAY=/home/gem/play

After saving above changes, I enter the command: source ~/.bashrc Now if I do echo $PATH, the path shows both the old PLAY_HOME and new PLAY_HOME. This is really bad and messes up a lot of things in my project. This problem only goes away if I logout or reboot, a rather very long process. What is happening is that the old path is added to new path element and the old path includes the old path element you want to remove.

View 10 Replies View Related

Fedora :: 12 And VMTools - The Path "" Is Not Valid Path To The Gcc Binary

Mar 23, 2010

running Windows 7 64bit with VMware Workstation 7.01-build 227600. I have some knowledge of Linux, I have installed f12 and have updated the system as of 03/22/2010. All updates completed successfully.

1) How do I install VMTools on the f12 (after mounting the CD/DVD tool package)

2) How do I update the gcc files it says are dependencies?

Here's what I get on installation:Before you can compile modules, you need to have the following installed...

kernel headers of the running kernel

and then I am prompted for this input from the install script:

Searching for GCC...
The path "" is not valid path to the gcc binary.
Would you like to change it? [yes]

and this is where I get stuck. How do I get around this or satisfy the requirements for the install?

View 5 Replies View Related

General :: Why Is It Bad To Add '.' To PATH?

Aug 26, 2010

I've read one explanation saying it can allow malicious executables that are in the cwd to run in place of similarly named built-ins and core utilities.For something to wreak true havoc, wouldn't this only apply to root? And in any case, if '.' were appended to PATH instead of prepended, shouldn't that circumvent this "replacement" attack, since PATH's directories are scanned in order? (Aren't they scanned in order?)Are there any other issues besides this one?

View 4 Replies View Related

General :: Run An Ls Without Getting The Full Path?

Nov 11, 2010

I want a simple list of files in a directory that is not my current directory. I run ls /other/directory/*.txt and get:

I want:

How can I get the second list?

View 4 Replies View Related

General :: Sudo Sometimes Changes PATH And Not Others?

Jan 22, 2011

If I try "shutdown" as a normal user on Debian it give the "command not found" error. OK it's not in my PATH. But if I "sudo shutdown" it works. Somehow sudo seems to change my PATH.

Do the same in Slackware however and sudo makes no difference, I get "command not found" each time.

View 8 Replies View Related

General :: How To Set The Path Variable

Jan 14, 2010

By mistake I have modified the PATH variable you know what a kind of mess it is.

echo $PATH

I just need to set the path variable again so I just need the format. Or can anybody come up with how to set the path variable.

View 6 Replies View Related

General :: What Is Full Path Name

Dec 15, 2010

What is a full path name?

View 6 Replies View Related

General :: Get Last Folder In Path?

Apr 12, 2011

I am trying to zip a directory but when I zip and unzip it, it contains the whole path of the variable "album". I would just like to zip the last folder in the path. Here is what I have now. I tried basename but that didn't seem to work, possible I just can't make it work right.



View 14 Replies View Related

General :: Get Last Subfolder On A Path?

Jul 29, 2011

I create a bash script and I assign a folder variable like:


is there any way to make another variable with just the specific SUBFOLDER

(?some command?)----> will make My_variable_subfolder = SUBFOLDER

so if I do

echo $Myvariable_FOLDER_PATH


and echo $My_variable_subfolder


The tree and path names will change so I jjust want the last subfolder that I will access to access its files.

View 3 Replies View Related

General :: How To Replace The Path

Feb 16, 2010

I added a path in my bash_profile so that I could use the executables in the directory (I thought). But it turned out some other directory has the same executables and the path had already been added by the previous user. Is there way to overwrite this path? I can't find where that old path was added.

View 10 Replies View Related

General :: Ls: Displaying The Whole Path?

Jun 7, 2010

GNU/linux kernel 2.6, slackware 12.0

Can ls display the whole path of a file? Suppose I have /media/cdrom1/*. So I want the output of ls to be


View 12 Replies View Related

General :: Specifying A Destination Path While Creating A Zip?

Feb 5, 2010

Let us assume I have a zip file called, when I run unzip -l I get the following output.


To this zip file I want to add a new file, "Readme.txt" located at /path/to/Readme.txt in such a way that, when I re-run unzip -l again I get something like this


View 2 Replies View Related

General :: Getting Duplicated Entries In $PATH?

Apr 28, 2010

I'm using Ubuntu 9.10 (karmic). And, my ~/.pam_environment looks like the following.

PATH DEFAULT=${PATH}:~/Adobe/Reader9/bin:~/texlive/2009/bin/x86_64-linux
MANPATH DEFAULT=${MANPATH}:~/texlive/2009/texmf/doc/man
INFOPATH DEFAULT=${INFOPATH}:~/texlive/2009/texmf/doc/info

But, echo $PATH returns me duplicated entries as the following.


I've tried replacing DEFAULT by OVERRIDE in my ~/.pam_environment file. But, that didn't help.

View 1 Replies View Related

General :: Getting Joystick Path In Windows

May 28, 2010

On Linux, I can access my joystick with the following path: /dev/input/js0. Is there a similar way I can access my joystick on Windows?

View 2 Replies View Related

General :: Create All Subdirectories Of A Path?

Dec 9, 2010

Is there an easy way to create all subdirectories of a path in linux ?

Something like

mkdir /a/b/c/d/e/f

executed in / should create directories a,b,c,d,e,f

View 2 Replies View Related

Copyrights 2005-15, All rights reserved