One I got interviewing for Ecommerce.com position.
Why doesn't this work?
Code:
$ for nr in `seq -w 0 10`; do printf "%2i\n" $nr; done
0
1
2
3
4
5
6
7
-bash: printf: 08: invalid number
0
-bash: printf: 09: invalid number
0
10
I had to research this because I couldn't answer on the spot. I emailed the answer back after the interview.
printf is interpreting '0' padded numbers as octals and
complaining about 08 and 09. Removing the '-w' option to seq will
prevent the padding.
Code:
$ for nr in `seq 0 10`; do printf "%2i\n" $nr; done
0
1
2
3
4
5
6
7
8
9
10
Same interview, I couldn't answer why whatever fedora version couldn't install on > 2TB partition. Answer was Not able to use GPT.
Same interview - what I like to drink. My answer to the interviewer - whatever you're buying.
Bookmarks