LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices


Old

Handling all file names safely in Bash

Posted 02-11-2012 at 12:09 PM by Nominal Animal
Updated 04-16-2012 at 02:41 AM by Nominal Animal (Fuller fixes.)
Tags bash, filename, nul

In Linux, each file or directory name (or more generally, pathname component) is just a string of bytes. It always ends with the C end-of-string mark, ASCII NUL: a zero. Value 47, ASCII /, is also reserved for use as a separator between pathnames.

Bash can read ASCII NUL separated data using read -d "" variable. It will, however, remove leading and trailing characters that match IFS, and return false (nonzero status) if the input does not have a final NUL. This applies to...
Senior Member
Posted in Uncategorized
Views 2248 Comments 0 Nominal Animal is offline

  



All times are GMT -5. The time now is 06:35 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration