BASH Shell

I need to set a bash environment variable called PURGEIMAGE and take specific actions in my script. For example, if PURGEIMAGE set, then purge images from CDN else just URL. I am going to call my script as PURGEIMAGE=yes ./ url1 url2. So how do I know if a bash variable set at the CLI and used in my bash script running on Linux or Unix-like systems?
[continue reading…]

I have two columns (fields) in my text file. I am trying to insert ‘| FOO This is a description
BAR Another description for bar
TEXT Another description for TEXT

So I ran awk '{ print $1 "|"; $1=""; print}' input > output but print command is adding a new line:
This is a description
Another description for bar
Another description for TEXT

Is there any way to tell awk not to print a newline and create the file? Here is what I want so that I can create final HTML table based upon ‘|‘:
FOO|This is a description
BAR|Another description for bar
TEXT|Another description for TEXT

[continue reading…]

I have many PDF files, and I need to convert them to a png file format, add a border to those images, and convert back all those images to pdf format. How can I convert pdf to image format on Linux and vice versa using the CLI?
[continue reading…]