Are whitespace-only Lines Allowed in /etc/fstab?

Asked by Ralph Corderoy on 2008-04-25

fstab(5) says lines starting with `#' are comments, fine. But what about lines containing only whitespace? Are they allowed? Checking getmntent(3) source isn't sufficient since scripts read /etc/fstab without using it. I think fstab(5) should clearly state one way or the other.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu util-linux Edit question
Assignee:
No assignee Edit question
Solved by:
Ralph Corderoy
Solved:
2008-04-25
Last query:
2008-04-25
Last reply:
2008-04-25
Bhavani Shankar (bhavi) said : #1

Hello Ralph

Tested it out now..

If you are using whitespaces it returns an error:

[mntent]: line 10 in /etc/fstab is bad

So its not advisable to use whitespaces..

From http://www.linux.se/doc/HOWTO/Adv-Bash-Scr-HOWTO/special-chars.html :

White space

functions as a separator, separating commands or variables. White space consists of either spaces, tabs, blank lines, or any combination thereof. In some contexts, such as variable assignment, white space is not permitted, and results in a syntax error.

I think this applies to fstab as well, unfortunately!

Regards

Bhavani Shankar.

Thanks Bhavani. It would be nice if fstab(5) explicitly stated they weren't allowed.