Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: symlink destination
- To: tlug@example.com
- Subject: Re: symlink destination
- From: Jake Morrison <jacob.morrison@example.com>
- Date: Wed, 25 Oct 2000 15:15:04 +0800
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain; charset=big5
- Organization: Syntegra
- References: <14838.29947.837620.510820@example.com>
- Reply-To: tlug@example.com
- Resent-From: tlug@example.com
- Resent-Message-ID: <1ZUgyD.A.Px.Ppo95@example.com>
- Resent-Sender: tlug-request@example.com
- Sender: jacob.morrison@example.com
Uvator, There is a readlink(2) system call on HP/UX. So..... #include <unistd.h> #include <limits.h> #include <stdio.h> int main(int argc, char** argv) { char buf[PATH_MAX + 1]; if ( (argc < 2) || (!argv[1]) ) { fprintf(stderr, "%s: usage: <symlink>\n", argv[0]); return 1; } if ( readlink(argv[1], buf, PATH_MAX) == -1) { perror("readlink"); return 1; } printf("%s\n", buf); return 0; } I can compile this for you on HP/UX 10.2 if you like. Regards, Jake Viktor Pavlenko wrote: > > A shell programming question: > > Is there a way to find out the destination of a symbolic link (the > file it links to) from a sh script? Parsing the output of `ls -l' is a > possibility but it doesn't feel right. > > Thanks. > > Viktor > > ----------------------------------------------------------------------- > Next Technical Meeting: November 11 (Sat) 13:30 Place: LinuxProbe Hall > Next Nomikai (and Bonenkai!): December 15 (Fri) > ----------------------------------------------------------------------- > more info: http://www.tlug.gr.jp Sponsor: Global Online Japan
- References:
- symlink destination
- From: Viktor Pavlenko <vp@example.com>
Home | Main Index | Thread Index
- Prev by Date: Re: symlink destination
- Next by Date: Re: symlink destination
- Prev by thread: Re: symlink destination
- Next by thread: Re: symlink destination
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links