Linux scripts going wonky? That’ll be the newline…

b10objects013Recently I’ve been working with Linux more closely than I have in the past, in part due to the use of ZENWorks 11 which in our case runs on SLES rather than Windows. Today I wanted to sort out the next stage of our imaging process, which involves customising the PXE boot menu so we can easily upgrade machines without needing to mess around with hardware rules (more on that later!)

Basically what this comes down to is a custom bash script to detect the machine type and run various imaging maintenance commands.

So I fired up my trusty editor of choice (the excellent Notepad2) to start editing. Feeling confident about the script it was duly copied to USB, mounted in Linux and… fail 😦

Bits of the script were running but bits were writing over the same line and other sections showing command not found5 

Hardened Linux fans will most likely be throwing things at the screen right now as the answer is devilishly simple… newlines! Not something you think about when only operating in the Windows world but unless you set it correctly any files made inside a Windows editor won’t work too well when you run them on Linux.

Luckily all it takes to sort is one click on the File Menu et voila, problem solved…

linux newline notepad2

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: