How to create file execution in KSH shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to create file execution in KSH shell
# 1  
Old 06-22-2006
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
# 2  
Old 06-22-2006
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
# 3  
Old 06-23-2006
MySQL Thank's for you help

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


heru
# 4  
Old 06-23-2006
Quote:
Originally Posted by grumpf
...
chmod +x /tmp/myexecuteable
/tmp/myexecuteable
This will also work:
Code:
...
sh /tmp/myexecuteable
...

Regards. Smilie
# 5  
Old 06-23-2006
next step is to use 'exec /tmp/myexecuteable'
to save some 0.002us and a few more bytes Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Restricted shell with execution permission on a file

Hi, I've created a user which shell is the restricted one (/usr/lib/rsh), but I've realized that the user cannot execute a script !!! The scope was to allow the ssh access to a user that could not access to any other directories but there that user should be able to run a script that retrieves ... (2 Replies)
Discussion started by: mary0
2 Replies

2. Shell Programming and Scripting

Execution of KSH after the Other ENDS

I have couple of scripts which I may have to execute one after the other. The Script1 creates trg files and second sciprt need to look for this trg file and proces further. I read in the forum that (./test1.sh && ./test2.sh) would work. Can you please let me know how do i use this where I need to... (3 Replies)
Discussion started by: Sukruth Kumar
3 Replies

3. Shell Programming and Scripting

Create Log File in ksh itself

Hi, I want to create a log file for a running ksh , and the log file absolute path I want to give in ksh itself. To elaborate this - Say I have a ksh - timer.ksh and I want to create a log timer_log.log when I run, to trace this. I am aware of the fact that this can be done using redirection... (4 Replies)
Discussion started by: vinay4889
4 Replies

4. Shell Programming and Scripting

ksh file execution problem

Hi, There is a ksh file as below /scripts/dir> ls -ltr script.ksh -rwxrwxrwx 1 oprlxr lxr 4937 Aug 19 11:13 script.ksh i logged on to the server with my ID and able to see the above file. I tried executing it but it was shoing below error. (JSKOBS) /scripts/dir>... (2 Replies)
Discussion started by: JSKOBS
2 Replies

5. Shell Programming and Scripting

KSH - Execution Time

Hello, I am on solaris 9 (KSH). I need to get the execution time of my script. I can't use the time command as I have to send by mail the result in a human readable way. So I am looking for a code to add to my script. The output result would be : Execution time :... (1 Reply)
Discussion started by: Aswex
1 Replies

6. Shell Programming and Scripting

Execution problem with ksh

Dear All, I have a script as follows: 1 #! /bin/ksh 2 # 28 varDate=`date +%d%h%y` 29 export spool_file=/app/my_user/work/TH_Status_${varDate}_Check.txt 30 31 ######################### 32 # Unix Code Starts here # 33 ######################### ... (3 Replies)
Discussion started by: saps19
3 Replies

7. Shell Programming and Scripting

create csv in ksh from tricky log file

hi guys, trying to create a csv from a tricky log file in ksh, using 'awk '{print $1" "$14" "$15" "$16" "$17" "$18" "$19}' >> $TMP_FILE' on another set of files I have an output file with hundreds of lines in which looks like so: ABC_DEFGHI_16_JKLMNP11.20101115_095412_374.log:09:54:29.579... (3 Replies)
Discussion started by: rich@ardz
3 Replies

8. Shell Programming and Scripting

ksh script to create a generic csv file from different source formats

Hi all, I have a requirement to create a "superset" file out of a number of different sources with some different and some same columns. We intend to have a manually updateable SuperSetCols.csv which would look like "ColA","ColB","ColC","ColD","ColE","ColF","ColG" so someday we may add... (3 Replies)
Discussion started by: Leedor
3 Replies

9. Shell Programming and Scripting

Execution Output of a shell script into a file.

Hi Experts, I have a script called test.sh. I am trying to execute it with sh -x test.sh. Where i can find sequence of steps executed one by one. Now i want to these executions to be captured in a file. i.e sh -x test.sh > output.txt the above one is notworking. can anyone help me... (6 Replies)
Discussion started by: naree
6 Replies

10. Shell Programming and Scripting

How to create file in ksh scripting with permission(rw-rw-rw)

Hi, Please provide your inputs.. Thanks in Advance, Mansa (1 Reply)
Discussion started by: mansa
1 Replies
Login or Register to Ask a Question