Can anyone show me an example of how to use the command PWD in Minix/Unix shell (language c)? just a simple example?
Printable View
Can anyone show me an example of how to use the command PWD in Minix/Unix shell (language c)? just a simple example?
I'm not understanding what you mean by Minix/Unix shell (language c) but in the C programming languageIn any shell scriptCode:#include <stdio.h>
#include <unistd.h>
#define SIZE 200
int main()
{
char name[ SIZE ];
if ( getcwd( name, SIZE ) == NULL ) {
perror( "getcwd error" );
}
else {
printf( "%s\n", name );
}
return 0;
}
Code:#!/bin/sh
pwd