0% found this document useful (0 votes)
2 views

File Operators Shell Scripting

The document outlines various shell file test operators, detailing their functions and providing examples for each. Operators include checks for block special files, character special files, directories, ordinary files, set group ID, sticky bits, named pipes, and file permissions (writable and readable). The assignment was completed by Abhishek Vishwakarma and submitted on September 16, 2022.

Uploaded by

abhishekvish36
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

File Operators Shell Scripting

The document outlines various shell file test operators, detailing their functions and providing examples for each. Operators include checks for block special files, character special files, directories, ordinary files, set group ID, sticky bits, named pipes, and file permissions (writable and readable). The assignment was completed by Abhishek Vishwakarma and submitted on September 16, 2022.

Uploaded by

abhishekvish36
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Name :- Abhishek Vishwakarma

Assignment date:- 15th September 22


Submission Date :- 16th September 22
Topics :- Shell File Test Operators

1. Operator :- -b file

Description :- Checks if file is a block special file; if yes, then the condition
becomes true.

Example :- [ -b $file ] is false.

2. Operator :- -c file

Description :- Checks if file is a character special file; if yes, then the


condition becomes true.

Example :- [ -c $file ] is false.


3. Operator :- -d file

Description :- Checks if file is a directory; if yes, then the condition becomes


true.

Example :- [ -d $file ] is not true.

4. Operator :- -f file

Description :- Checks if file is an ordinary file as opposed to a directory or


special file; if yes, then the condition becomes true.

Example :- [ -f $file ] is true.


5. Operator :- -g file

Description :- Checks if file has its set group ID (SGID) bit set; if yes, then
the condition becomes true.

Example :- [ -g $file ] is false.

6. Operator :- -k file

Description :- Checks if file has its sticky bit set; if yes, then the condition
becomes true.

Example :- [ -k $file ] is false.


7. Operator :- -p file

Description :- Checks if file is a named pipe; if yes, then the condition


becomes true.

Example :- [ -p $file ] is false.

8. Operator :- -w file

Description :- Checks if file is writable; if yes, then the condition becomes


true.

Example :- [ -w $file ] is true.

9. Operator :- -r file

Description :- Checks if file is writable; if yes, then the condition becomes


true.

Example :- [ -r $file ] is true.


10. Operator :- -e file

Description :- Checks if file is writable; if yes, then the condition becomes


true.

Example :- [ -e $file ] is true.

11. Whileloop:-

You might also like