My script so far can handle the ls command and returns the files in the directory. Now i am trying to make it handle commands like ls -l /tmp . Any help? My script so far:#!/bin/bash#set -xclearread -p type a command:   file    read -r -a prog <<<$file    IFS=: read -r -a paths <<<$PATH        for val in ${prog[@]} ; do         for path in ${paths[@]}; do                 [[ -x $path/$val ]] && $path/$val  $@                 done        done
How to create shell script to handle commands like ls -l /somedir
shell script;scripting
Maybe like this:#!/usr/bin/env bashclearIFS=: read -r -a paths <<<$PATHread -p type a command:   cmdread -d ' ' file <<<$cmd  #the first component of commandfor path in ${paths[@]}; do         [ -x $path/$file ] && eval $path/$cmddoneThis basically runs the inputted command for every possible PATH resolution.