echo Scriptname


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting echo Scriptname
# 1  
Old 06-05-2006
echo Scriptname

I have several crontab scripts running which email me status. Some of these scripts perform identical tasks so I get a similar emails sent to myself.

How do I get the script to print it's own path/filename so I can include it in the status updates without hardcoding trhe filename into the script?

Any help is appreciated.
# 2  
Old 06-05-2006
refer

use the $0 variable inside the script. It refers to the command runitself.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Should I run scripts like sh /absolute_path/to/scriptname.sh or just /absolute_path/to/scriptname.sh

Shell : Linux Bash OS version : RHEL 6.X, Oracle Linux 6.X Question1. To execute shell scripts, sometimes I see Linux admins placing sh command before shell scripts like below sh /home/appadmin/sync_pending_orders.shBut, I execute shell scripts like below ie. Just the absolute path ... (4 Replies)
Discussion started by: John K
4 Replies

2. Shell Programming and Scripting

Search jobname via scriptname in autosys

Hi I was wondering if there was any command with autorep that can be used to check what the jobname is by givin scriptname that is defined in the JIL of the job (1 Reply)
Discussion started by: sidnow
1 Replies

3. Solaris

Need to execute the script with script name wihtout using ./scriptname in Solaris 10

Hi, I am using solaris 10.Is there any way to execute the script with the scriptname wihtoug using ./scriptname?Also does it varies from shell to shell.I have scripts in bash,ksh,sh shells. Example:script.sh is the script name.I need to execute the script like this script.sh instead... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

4. Shell Programming and Scripting

tcsh - understanding difference between "echo string" and "echo string > /dev/stdout"

I came across and unexpected behavior with redirections in tcsh. I know, csh is not best for redirections, but I'd like to understand what is happening here. I have following script (called out_to_streams.csh): #!/bin/tcsh -f echo Redirected to STDOUT > /dev/stdout echo Redirected to... (2 Replies)
Discussion started by: marcink
2 Replies

5. Shell Programming and Scripting

With that logic this echoes "echo". Question about echo!

echo `echo ` doesn't echoes anything. And it's logic. But echo `echo `echo ` ` does echoes "echo". What's the logic of it? the `echo `echo ` inside of the whole (first) echo, echoes nothing, so the first echo have to echo nothing but echoes "echo" (too much echoing :P):o (2 Replies)
Discussion started by: hakermania
2 Replies

6. UNIX for Dummies Questions & Answers

How to correctly use an echo inside an echo?

Bit of a weird one i suppose, i want to use an echo inside an echo... For example... i have a script that i want to use to take users input and create another script. Inside this script it creates it also needs to use echos... echo "echo "hello"" >$file echo "echo "goodbye"" >$file ... (3 Replies)
Discussion started by: mokachoka
3 Replies

7. Shell Programming and Scripting

Difference between using "echo" builtin and /bin/echo

So in my shell i execute: { while true; do echo string; sleep 1; done } | read line This waits one second and returns. But { while true; do /bin/echo string; sleep 1; done } | read line continues to run, and doesn't stop until i kill it explicitly. I have tried this in bash as well as zsh,... (2 Replies)
Discussion started by: ulidtko
2 Replies

8. Shell Programming and Scripting

/bin/ksh: scriptname: not found. ???

I have started to write Korn scripts on the client's AIX 4.2 servers and there is this small problem that puzzles me. I code all my scripts the same way: - first line contains : #!/bin/ksh - I do this console command on every scripts: chmod +x scriptname But still, on some occasions,... (4 Replies)
Discussion started by: Browser_ice
4 Replies

9. Solaris

bash: ./<scriptname>: No such file or directory

I have simply downloaded a file to my local folder, made one small change and uploaded it back, ever since it will not run the file. I have now uploaded the original, unchanged file, which still doesn;t work. Evertime it is run ot says bash: ./nrcardprint: No such file or directory The... (10 Replies)
Discussion started by: Heidi.Ebbs
10 Replies

10. UNIX for Dummies Questions & Answers

run script without ./scriptname

Hi everyone, I'm very new, I just wrote a script "Hello World" :) LOL How can I execute the script without the ./myscript. I want to just type "myscript" basically from anywhere without the " ./ ". Thanks a bunch, NinjaX (2 Replies)
Discussion started by: NinjaXman
2 Replies
Login or Register to Ask a Question