nixCraft Linux / UNIX Newsletter

Link to [RSS/Feed] nixCraft: Linux Tips, Hacks, Tutorials, And Ideas In Blog Format

How to check if bash variable defined in script

Posted: 29 Jan 2021 03:30 AM PST

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 ./purgecache.sh 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?

The post How to check if bash variable defined in script appeared first on nixCraft.

Bash Shell: Replace a String With Another String In All Files Using sed and Perl -pie Options

Posted: 28 Jan 2021 11:20 PM PST


{Updated} How do I replace a string with another string in all files using sed, Bash or Perl?

The post Bash Shell: Replace a String With Another String In All Files Using sed and Perl -pie Options appeared first on nixCraft.