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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Magic bytes for Executable and Linkable format

A

0x7f (backspace)

‘E’ ‘L’ ‘F’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Writing a script

A

Start with magic bytes + name of interpreter

chmod +x file

./file

OR
bash file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Plain text file problems

A
  1. Line feeds/tabs
  2. MS - two control character sequence for end of line = carriage return + line feed
  3. Conversions via dos2unix/iconv
  4. 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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 #!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly