06-05-2004
getting a shell script to know it's path
Is it possible in Bash (or any other shell) to get a shell script to know it's own path without having to be part of $PATH or anything like that.
I need this cos i want the script to be able to rename the directory in which it resides.
is this possible?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
UNIX Shell Script
I'm in /home/suneel dirctory
in that directory need to check for a path for example com/src/resources
If Path exists need to copy the files from one directory
If path not exist need to create the folders and copy the files
UNIX shell script help required (3 Replies)
Discussion started by: suneelc
3 Replies
2. UNIX for Dummies Questions & Answers
hi,
I am using solaris10. I have to write a bourne shell script, which copies files for the said destination path which is passed as an argument to the script.
it looks like this
myscript.sh /var/test -->destination path
now i would like to know what is the maximum length i can... (3 Replies)
Discussion started by: raghu.amilineni
3 Replies
3. Shell Programming and Scripting
hi i wrote following script,
#!/usr/bin/sh
for index in `ls /tmp/common/*.txt`
do
echo "$index"
done
here index is giving full path but in my program i want only file names (not along with whole path)
Eg. if in /tmp/common files are a.txt and b.txt den out should be a.txt b.txt
... (6 Replies)
Discussion started by: crackthehit007
6 Replies
4. Shell Programming and Scripting
Hi,
Can anyone help me on how to set PATH using shell scripting..
Please find the shell script code here....
#!/bin/bash
PATH = $PATH:/opt/app/oracle/product/10.2.0/bin
export PATH
echo $PATH
exit
When i execute this script i get the following error
./backup.sh: line 2: PATH:... (0 Replies)
Discussion started by: srinivasj
0 Replies
5. Shell Programming and Scripting
Hi ,
i need a shell script to poll a particular file in a predefined directory , once that file is found , i need to launch another shell script .
Eg i need to poll for A.txt in /home/username/Desktop
once A.txt is created by Desktop(Created by another Script) , i need to launch another... (2 Replies)
Discussion started by: Vinod H C
2 Replies
6. Shell Programming and Scripting
Hello forum members,
I have to create a out file in the current path./aaa/bbb/ccc/hhh.
i am writing script below.
###script Begins#####
#!/bin/ksh
echo "Weclome"
if
then
echo "Hello"
rm -rf $aaa/bbb/ccc/hhh #clean the exsisting o/p file
echo "no... (2 Replies)
Discussion started by: rajkumar_g
2 Replies
7. Shell Programming and Scripting
Hello to all in forum
I hope you can help me.
I want to send via FTP to a linux server the 2 kind of files that are in the same folder, as follow:
1- Send all files that are named verified.SomeString.zz.pttp to path /var/verified
2- Send all files where the name begins with verified.conf... (3 Replies)
Discussion started by: Ophiuchus
3 Replies
8. Shell Programming and Scripting
I'm trying to set the path permanently through a shell script. (/opt/quest/bin:/usr/bin/lab to /.profile.) I tired using echo option like below but it doesn't work. Please suggest me the right way to do so.
echo "PATH=$PATH:/opt/quest/bin:/usr/bin/lab" >> /.profile (6 Replies)
Discussion started by: pjeedu2247
6 Replies
9. UNIX for Dummies Questions & Answers
I've created a test script, which is located in $HOME/bin. The script runs as expected with no issues. However, upon echo'ing the $path variable the location of my script is not located in any of the directories listed in $path. So my question is, how does shell know where the script is located... (2 Replies)
Discussion started by: BrandonD
2 Replies
10. UNIX for Beginners Questions & Answers
Hi ALL,
I am trying to find the installed tomcat version and location of the server.xml file to get the tomcat port number.
Using below script to do that.
#!/usr/bin/env bash
var1=$(find / -name "version.sh" ! -size 0 2>&1 |egrep -v "tmp|docker")
for loc1 in $var1
do
... (1 Reply)
Discussion started by: sravani25
1 Replies