-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspec3.c
More file actions
61 lines (42 loc) · 1.8 KB
/
spec3.c
File metadata and controls
61 lines (42 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* Conclusion Spec ---3
warp test -> cd test
warp Copies -> cd Copies
warp ->(only cd ==> cd ~) No Args passed
warp . -> cd . = remain in the current directory, refeshing it ,wont move anywhere
warp ~ -> cd ~ = /home/popos (or refers to home directory of shell)
warp - -> cd - = last pwd executed (only 2 pair as history)
warp .. -> cd .. = move to the parent directory of current directory
cd / -> root directory is the first directory in your filesystem hierarchy.
Absolute path : cd /home/popos/OSN/Copies ,directly changes from any place(**)
Relative path : cd dir_1/dir_2/dir_3 ,between folder relative
e.x. <JohnDoe@SYS:~/test/tutorial> warp ~/project
/home/johndoe/project
<JohnDoe@SYS:~/project>
Execute warp sequentially :implement ,not direct as ,cd Accepts 1 command
<JohnDoe@SYS:~/test/assignment> warp .. tutorial
/home/johndoe/test
/home/johndoe/test/tutorial
The first code is without the root directory (/) and the second code is with the root directory (/).
chdir() is a system function. This means that it uses the absolute paths. If the Linux home directory (/) is not specified as the start of the path.
";
*/
/*void main3(){
char cwd[256];
if (getcwd(cwd, sizeof(cwd)) == NULL)
perror("getcwd() error\n");
else
printf("current working directory is: %s\n", cwd);
char pa[]=".. \n"; // or char *pa
int ch=chdir(pa);
if(ch<0) //-1
printf("chdir change of directory not successful\n");
else //0
printf("chdir change of directory successful\n");
if (getcwd(cwd, sizeof(cwd)) == NULL)
perror("getcwd() error\n");
else
printf("current working directory is: %s\n", cwd);
printf("getenv %d", strlen(getenv("HOME")));
printf(" homedir %d",strlen(gethome()));
}
*/