Quote:
Originally Posted by
cola
How to check if a partition is mounted or not with bash?
And when is $? variable one?
Please give example.
1. You can't "mount" a partition, only a "filesystem". This differentiation might seem picky, but in fact it is an important one.
2. You can't check it's mounting status with a shell, because a shell is a means to execute programs. You can use such a program - "mount", "df", probably some more - to find out if a filesystem is mounted, but that would be irregardless of the shell used.
3. "$?" is a variable set by an exiting program and contains the error code (or "error level"). If you want to know what an error level of 1 means for a certain program have a look in that programs man page.
4. You might want to read some introductory books about the Unix OS to get some basics. It won't do you any good in the long run, if you ask questions which show a clear lack of understanding of the underlying concepts. You might not understand the answer given and gain nothing from it - even if the answer is correct.
I hope this helps.
bakunin