You've written a script that processes a list of files. You want to ensure that even if a filename contains spaces, it's treated as a single argument. Which built-in variable should you modify?
- IFS (Internal Field Separator)
- PS1 (Prompt String 1)
- OIFS (Original Internal Field Separator)
- FS (Field Separator)
To ensure that filenames with spaces are treated as single arguments in a script, you should modify the OIFS (Original Internal Field Separator) variable. This allows you to temporarily change the IFS value to a specific character (e.g., newline) and then restore it to its original value after processing the filenames. This ensures that spaces don't break the filenames into multiple arguments.
Loading...
Related Quiz
- To monitor I/O statistics and disk activity in real-time, you would use the ________ command in Linux.
- You notice that a remote server is not accessible via its hostname, but it's accessible via its IP address. Which configuration file would you inspect first?
- In Debian-based systems, the ________ command is used to search for packages.
- Which Linux distribution focuses primarily on security and is often used for penetration testing?
- Which special variable in a shell script represents the script's name?