Sending data to an embedded language code

If we want to send data to the embedded language script, then one way is to send it via variable content. Look at the following example:

    $ export location="/etc"; ksh -c "ls $location"

In the preceding example, we are initializing a variable location with the path or folder name. When shell executes the  ksh command, it will pass path as content of $location. Then, ksh will print the content of the directory required.

Get Learning Linux Shell Scripting - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.