two simple question on shell scripts....

:smiley: my first question is how can envoke filename expansion from within a shell script.. forinstance if i execute the script and it asks for a specific directory that i would like to cd to, how can i get the script to use the same file name expension as the command line..
my second question is how can I run a new shell in the middle of an executed script for edditting files using the stream editor specifically..
# !/bin/sh
# .file_manager

function usage () { echo "USAGE"; echo "in $USER for text invoked by grep Directory must be prefixed by "Filesystem1" (ex.. Filesystem1/linuxconcpt/databseii); in root mode prefix with Filesystem1 all the time.. CWD (current working directory must be /hom
e/$USER/Filsystem1 in both .......)": echo "choose from named parameters ...,Nts,nts.. TXT, txt, Txt , loc or Loc, fle or Fle,fls or Fls"; echo "*capital for text, lowercase for directories and files"; echo "Exec & EXEC only uppercase..!"; echo "choose Mo
nth/month to get first 7 lines of text.. (Month ,only text, for Dir Unixformat)"; echo " Month can be applied to Dir linuxconcpt as all other text choices"; echo "enter C to access C_programms Dir"; echo "Enter dirctory or suffix or both..(must enter suf
fix.. enter all or ls to see addresses"; echo "enter X or x for xterm)"; echo "press CL/C to exit"; }

while :;do
usage
echo `pwd`
echo "Enter Dirctory or Hit Enter :"
read Dir
read input

if [ $DIR -d ]
then
echo "$Dir"
else
:;
while [ $input == 0 ]
do
dir="/home/moxxx68/Filesystem1"

done
fi

echo "Enter choice:"
read type
case $type in
Txt) grep -R -nB2 "(Txt)" ~/$Dir/* |less && ls -ali ~/$Dir --color
;;
Loc) grep -R -nB2 "(Loc)" ~/$Dir/* | less && ls -ali ~/$Dir --color
;;
Nts) grep -R -nB2 "(Nts)" ~/$Dir/* | less && ls -ali ~/$Dir --color
;;
Fle) grep -R -nB2 "(Fle)" ~/$Dir/* | less && ls -ali~/$Dir --color
;;
Fls) grep -R -nB2 "(Fls)" ~/$Dir/* | less && ls -ali ~/$Dir --color
;;
Exec) grep -R -nB2 "(Exec)" ~/$Dir/* | less && ls -ali ~/$Dir --color
;;
EXEC) grep -R -nB2 "(EXEC)" ~/$Dir/* | less && ls -ali ~/$Dir --color
;;
Month | month) egrep -R -n5 "(month\:|Month\:)" ~/$Dir/* | less && ls -$1 ~/$Dir --color | more
;;
txt) ls -$1 --color ~/$Dir | grep -n 'txt' | column -t
;;
loc) ls -$1 --color ~/$Dir | grep -n 'loc' | column -t
;;
nts) ls -$1 --color ~/$Dir | grep -n 'nts' | column -t
;;
fls) ls -$1 --color ~/$Dir | grep -n 'fls' | column -t
;;
fle) ls -$1 --color ~/$Dir | grep -n 'fle' | column -t
;;
doc) ls -$1 --color ~/$Dir | grep -n 'doc' | column -t
;;
c) ls -$1 --color ~/$Dir | grep -n 'c' | column -t
;;
TXT) egrep -nA5 -R '([a-z]|[0-9]\:)' ~/$Dir/* | less && ls -$1 ~/$Dir --color | more
;;
all) ls -$1 --color ~/$Dir | more && xterm -bg black -fg white ; egrep -R -nA5 '([a-z]|[0-9]\:)' ~/$Dir/* | less
;;
ls) ls -$1 ~/$Dir --color | more
;;
X|x) xterm -bg black -fg white&
;;
clear) { clear; pwd; tty; date; }
continue;
;;
exit) { clear; pwd; tty; date; }
break;
;;
*)echo "ERROR NO SUCH USAGE"
;;
esac;

done
any feedback welcome
thanx moxxx68:)

:slight_smile: i can just envoke the use of a shell for the stream edittor through a xterm terminal.. but what i really would like to know.. is it possible to script in a basic command as in C (fopen) where i go directly to a file on the through the script using forever loops to get in and out of the file on the same screen or would this be taskious. also i have never actually thought about it before but there must be some way to get directory and filename expansion as part of the response to the script prompt to enter dir path.. if any one could leave any kind of information I would be glad to figure out the rest by myself.....
would appreciate input from anyone
thanx moxxx68:rolleyes: :slight_smile:

oops accident,,,, no reply required !

unitentional editting mistake,,,,