Find the answer to your Linux question:
Results 1 to 2 of 2
Can anyone show me an example of how to use the command PWD in Minix/Unix shell (language c)? just a simple example?...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2003
    Posts
    6

    PWD


    Can anyone show me an example of how to use the command PWD in Minix/Unix shell (language c)? just a simple example?

  2. #2
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319
    I'm not understanding what you mean by Minix/Unix shell (language c) but in the C programming language
    Code:
    #include <stdio.h>
    #include <unistd.h>
    #define SIZE 200
    
    int main&#40;&#41;
    &#123;
      char name&#91; SIZE &#93;;
      if &#40; getcwd&#40; name, SIZE &#41; == NULL &#41; &#123;
        perror&#40; "getcwd error" &#41;;
      &#125;
      else &#123;
        printf&#40; "%s\n", name &#41;;
      &#125;
    
      return 0;
    &#125;
    In any shell script
    Code:
    #!/bin/sh
    pwd
    The best things in life are free.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •