So far "ls" works fine i take all files in the directory. But now i want when i execute ./myscript ls -l /somedir to take the same results as i take when i type ls -l /somedir at the terminal.
Is there any way to make it? This is my code so far..
#!/bin/sh
clear
echo ""
read -p "type something : " file
echo""
IFS=:
for dir in $PATH ; do
if [ -x "$dir/$file" ]
then
echo ""
exec "$dir/$file"
fi
done
ls -1 somedirto yourscript.sh? e.g.ls -1 /somedir | sh yourscript.sh?lsi take back the files of the directory. Now i want when i typels -l / tmpto take as return what i would take by typingls -l /tmpatuser@user:~$at my terminal. @aho