Make Unix Command Paths

mkunixcmds is a simple Bash script to generate a Unix command paths macro specification file (for example, unixcmds_redhat_linux_macros.cfg).

As with other scripts, we source this script from a mkunixcmds_programs.cfg PIKT configuration file (not shown).  The end-use, target script follows.

#!/bin/bash

# mkunixcmds -- make a unix command paths macro specification file

for c in `find /bin /usr/bin /sbin /usr/sbin -print | awk -F/ '{print $NF}' | sort | uniq`
do
        p=`which $c 2>/dev/null | tail -1`
        if [ X$p != X ]
        then
                echo "$c $p"
        fi
done

We take the 'tail -1' of 'which' in the line

        p=`which $c 2>/dev/null | tail -1`

to handle the special situations where a command might resolve to an alias.

Before using this script, make sure that /bin, /usr/bin, /sbin & /usr/sbin are all in your environment path.  Add additional bin directories as needed.

Note that some additional cleanup may be required.

For more examples, see Samples.

Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2019-01-12.   This site is PIKT® powered.
Copyright © 1998-2019 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View sample
checksum
differences
Pikt script