Published on March 11, 2017 by ProgrammingKnowledge

For more detailed Tutorial visit – goo.gl/vn9xIb

Shell Script has many operators that you can use to test different aspects of a file. For example, you can use the -e operator to ensure that a file exists before deleting it. Or, you can check that a file can be written to before appending to it. By checking the feasibility of the impending file operation, you can reduce the number of errors that your program will encounter.

My Website – www.codebind.com
My Blog – goo.gl/Nd2pFn
My Facebook Page – goo.gl/eLp2cQ
Google+ – goo.gl/lvC5FX
Twitter – twitter.com/ProgrammingKnow
Pinterest – goo.gl/kCInUp
Text Case Converter – goo.gl/pVpcwL
Epoch Timestamp Converter – goo.gl/Zedjo5
Decimal – Binary – Hexadecimal Converter – goo.gl/rkX3JE
8-bit Checksum Calculator – goo.gl/inxvIT

Leave a Reply

10 Comments on "Shell Scripting Tutorial for Beginners 6 – File test operators"

Notify of
avatar

Xieerqi
Guest
Xieerqi
1 month 20 hours ago

On 7:10 mark author of the video states that character special file is a normal file which contains text, while block file is file like video or picture file. That's not true. Block files are used to represent partitions of a hard drive, usb sticks, memory devices,etc. Character devices are typically consoles, like /dev/tty1, or devices that generate characters such as /dev/zero. Thus, -b flag will not work on video file but will work on partition file such as /dev/sda1. Video and text files are still considered regular files, not character or block.

Gleb Bondarenko
Guest
Gleb Bondarenko
2 months 28 days ago

Instead of echo -e "… c"you can useecho -n "…"

Ergis Hotza
Guest
Ergis Hotza
5 months 3 days ago

Very well explained thnx

Mohammad Faizan
Guest
Mohammad Faizan
5 months 4 days ago

Nice…Very understandable..Thankx

faiz shaikh
Guest
faiz shaikh
5 months 5 days ago

ECOMMERCE BASED…

faiz shaikh
Guest
faiz shaikh
5 months 5 days ago

PLEASE….

Anonymous
Guest
Anonymous
5 months 5 days ago

is it helps for marketing sir?

lexand007
Guest
lexand007
5 months 5 days ago

Learn marketing with shell? I don't think it's the best idea.

Ajmery Yeasmeen Bithi
Guest
Ajmery Yeasmeen Bithi
5 months 5 days ago

i wanna learn about marketing please help me.

faiz shaikh
Guest
faiz shaikh
5 months 5 days ago

SIR MAKE AN PROJECT IN ASP.NET MVC ….

wpDiscuz