Posts

Showing posts with the label busybox

/bin/sh Need to identify file content type

Image
Clash Royale CLAN TAG #URR8PPP /bin/sh Need to identify file content type I'm working on busybox and have only /bin/sh available. I would like to understand if the file I'm processing with my script are to be treated as ASCII (just read and do what I need to do) or gzip (so unzip first then do what I need to do). The "file" command here would be perfect, but unfortunately it's just not available, hence I don't know what procedure to call as the input file I'm processing can be either format. I'm wondering if there's a simple workaround I'm missing here to find this out... What do you consider "non-ASCII"? Do you just need to test if your file has no characters with values outside 0-127? – Charles Duffy 13 mins ago You could check for the same magic number file l...