evvsubst – substitute variables in text in shell

First you need to install gettext, which by the way might be already installed, however you can install with

dnf install gettext

Details of the package:

Name        : gettext
Arch        : x86_64
Epoch       : 0
Version     : 0.19.4
Release     : 4.fc22
Size        : 4.6 M
Repo        : @System
Summary     : GNU libraries and utilities for producing multi-lingual messages
URL         : http://www.gnu.org/software/gettext/
License     : GPLv3+ and LGPLv2+
Description : The GNU gettext package provides a set of tools and documentation for
: producing multi-lingual messages in programs. Tools include a set of
: conventions about how programs should be written to support message
: catalogs, a directory and file naming organization for the message
: catalogs, a runtime library which supports the retrieval of translated
: messages, and stand-alone programs for handling the translatable and
: the already translated strings. Gettext provides an easy to use
: library and tools for creating, using, and modifying natural language
: catalogs and is a powerful and simple method for internationalizing
: programs.

Usage examples:

cat file |envsubst
# substitute variables and copy to clipboard
cat file |envsubst |xclip -i

bash refer parameters from the current command

In bash you can use

!#

to refer to any parameter from the current command, example:

mv ak amit.!#:1.txt
ls amit.ak.txt

Checking the links to your site (from affiliates) using cron and bash script.

If you have some affiliate links and are concerned about their presence then you can setup cron to check the links for you regularly. For this you need a very simple script (as below) and a cron entry (example further down).

#!/bin/bash –
#===============================================================================
#
#          FILE:  checklinks.sh
#
#         USAGE:  ./checklinks.sh
#
#   DESCRIPTION:  Check if the links exists on affiliate sites
#
#       OPTIONS:  —
#  REQUIREMENTS:  —
#          BUGS:  —
#         NOTES:  —
#        AUTHOR:  Amit Agarwal (AKA), [email protected]
#       COMPANY:  Individual
#       VERSION:  1.0
#       CREATED:  04/07/2010 08:19:29 AM IST
#      REVISION:  —
#===============================================================================

websites=\”space seperated website address like http://amit-agarwal.co.in http://blog.amit-agarwal.co.in\”
echo \”Checking the sites for Links\”
echo $websites|tr \’ \’ \’\\n\’
echo
echo
for i in $websites
do
curl -s $i |grep amit-agarwal.co.in > /dev/null
if [ $? != 0 ]
then
echo \”Link not found on $i\”
fi
done

Then make a crontab entry like this:

40 08 * *  * (echo \”Subject: Link verification on affiliate sites @ `date`\”;<fullpath>/checklinks.sh) |/usr/sbin/sendmail <email>

\"Reblog