Hi Guys: I am trying to add password to my bash script file. So, it should ask for password when anyone try to open that file. (for eg. anyone perform cat or vi command on that file it should ask for password).

Thanks
Sonu

In general, one does not password protect a file. The way files are protected in Linux is with file permissions. If you set the file to be readable by only the owner and place it in a directory that is private to your account (also with read access turned off) then you and root are the only people who should have access to that file.

It may be that some GUI-based applications will provide this functionality but that does not directly carry over to something like cat or vi.