11 Scripts and plain-text files Flashcards
1
Q
Magic bytes for scripts intended for processing by interpreter named in rest of line
A
!/bin/bash
2
Q
Magic bytes for Executable and Linkable format
A
0x7f (backspace)
‘E’ ‘L’ ‘F’
3
Q
Writing a script
A
Start with magic bytes + name of interpreter
chmod +x file
./file
OR
bash file
4
Q
Plain text file problems
A
- Line feeds/tabs
- MS - two control character sequence for end of line = carriage return + line feed
- Conversions via dos2unix/iconv
- Flowed plain text format – do we store LF within paragraph, and line wrapping of paragraph happens only when the file is being displayed – LF used to terminate paragraphs
5
Q
Byte order mark
A
Windows notepad
BOM U+FEFF
invisible character if FEFF
invalid if FFEF
check to derive endianness of a 16 bit file
subsequently used as a marker for UTF8 formats
interferes with magic bytes for Unix shell scripts #!