How to create file execution in KSH shell

Dear all,

I'm new in Unix system, I need help about how to create execution file.
for example in my system i have file fg*
when i open fg file i get :
cmd='basename$0'
$cmd "$@"

how to create file like that (execution file) in KSH shell

thank you for your help

heru

IFF i understand correctly you are trying to create a file an execute it ?
(Note: there are better ways )

try someting like this:

cat <<EOF >/tmp/myexecuteable
#!/bin/sh
echo "hello world"
EOF

chmod +x /tmp/myexecuteable
/tmp/myexecuteable

thank's Grumpf for your help, this work..
:slight_smile:
have nice day

heru

This will also work:

...
sh /tmp/myexecuteable
...

Regards. :slight_smile:

next step is to use 'exec /tmp/myexecuteable'
to save some 0.002us and a few more bytes :slight_smile: