read a path


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting read a path
# 1  
Old 07-18-2007
read a path

Hi I'm trying to write a script in which,if i log onto a particular server,the script should automatically find the server i'm on (which is the source server).We can find it frm the path /transfer/common/utilities/env_params.txt

please help me as to how start with this,shall i use the read cmmnd or any ideas...................pls urgent help needed
# 2  
Old 07-18-2007
why don't you try doing
Code:
echo $lHOSTNAME

. It will give you the servername to which you have logged on.
kamitsin
# 3  
Old 07-18-2007
Data read a path

Quote:
Originally Posted by kamitsin
why don't you try doing
Code:
echo $lHOSTNAME

. It will give you the servername to which you have logged on.
Hi Kamitsin
thnks for the reply,but what i was looking for was, i need to write a script in which if any other user runs that script,the script must automatically read the /transfer/common/env_params.txt and output the source/host the user is logged on.The host info is on /transfer/common/env_params.txt
# 4  
Old 07-18-2007
Quote:
Originally Posted by bkan77
Hi Kamitsin
thnks for the reply,but what i was looking for was, i need to write a script in which if any other user runs that script,the script must automatically read the /transfer/common/env_params.txt and output the source/host the user is logged on.The host info is on /transfer/common/env_params.txt
What is this homework?

Just put echo $hostname in .profile
# 5  
Old 07-18-2007
read a path

Quote:
Originally Posted by syndex
What is this homework?

Just put echo $hostname in .profile
no its not,am trying to find a way where a script, when placed on any server detects the name of the server when the user runs the script and terms it as the host server.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Makefile missing include path Although the path exists and defined

i have make file which i try to make them generic but it keeps to compline it missing include directory this is the makefile : CXX=g++ CPPFAGS= -Wall -O0 -g -std=c++14 INCLUDES = -I/home/vagrant/libuv/include -Isrc LIBS_DIRS = -L/home/vagrant/libuv/build LDFLAGS=... (7 Replies)
Discussion started by: umen
7 Replies

2. UNIX for Beginners Questions & Answers

Convert Relative path to Absolute path, without changing directory to the file location.

Hello, I am creating a file with all the source folders included in my git branch, when i grep for the used source, i found source included as relative path instead of absolute path, how can convert relative path to absolute path without changing directory to that folder and using readlink -f ? ... (4 Replies)
Discussion started by: Sekhar419
4 Replies

3. UNIX for Advanced & Expert Users

Command to see the logical volume path, device mapper path and its corresponding dm device path

Currently I am using this laborious command lvdisplay | awk '/LV Path/ {p=$3} /LV Name/ {n=$3} /VG Name/ {v=$3} /Block device/ {d=$3; sub(".*:", "/dev/dm-", d); printf "%s\t%s\t%s\n", p, "/dev/mapper/"v"-"n, d}' Would like to know if there is any shorter method to get this mapping of... (2 Replies)
Discussion started by: royalibrahim
2 Replies

4. Shell Programming and Scripting

Moving files from parent path to multiple child path using bash in efficient way

Hi All, Can you please provide some pointers to move files from Base path to multiple paths in efficient way.Folder Structure is already created. /Path/AdminUser/User1/1111/Reports/aaa.txt to /Path/User1/1111/Reports/aaa.txt /Path/AdminUser/User1/2222/Reports/bbb.txt to... (6 Replies)
Discussion started by: karthikgv417
6 Replies

5. Shell Programming and Scripting

BASH - read use a path as input

I am trying to script simply data transfer. I would like to have the user input the source "SRC" (/Volumes/DriveName/Users/johnq123) and then name the directory that the copied information will go to, "DST" . put I can't get it to work - #!/bin/bash ... (8 Replies)
Discussion started by: dropkick888
8 Replies

6. Shell Programming and Scripting

Executing Commands From Non-Standard Path (Changing user's PATH secretely???)

Hi: I have a requirement as below: I have some standard Unix commands modified and kept them in a directory say /usr/clsh/bin. For example I have a script named "ls" kept here which is modified version of "ls" (say it always gives long listing i.e. ls -l). When any user logs on and types... (2 Replies)
Discussion started by: ramesh_samane
2 Replies

7. Shell Programming and Scripting

how to read the relative path

suppose i ahve a shell script Nsdnet.sh inside a directory /dialp/Release/bin another file nsdnet_file.csv is under the same directory. Now in the shell script i have call a java file, which reads the csvfile from the commandline. Now when i run the file as $ ./Nsdnet.sh ./nsdnet_file.csv then... (5 Replies)
Discussion started by: priyanka3006
5 Replies

8. Shell Programming and Scripting

need sed command to read a path and set to variable

I have a variable called PATH that contains a path example: /Users/rtipton/Desktop/testusers/test I need a sed command to set a variable called USER to the last directory name in that path PATH="/Users/rtipton/Desktop/testusers/test" and from that PATH i need USER to = test I know sed... (4 Replies)
Discussion started by: tret
4 Replies

9. Shell Programming and Scripting

Read the directory path

Hi, I have a requirement,where i have to read the directory path then read the files present in the directory Also I need to check the directory path exist in the local drive. These directory path are mentioned in the Primary.csv file under the column Dir. Primary.csv Dir,File1,File2... (1 Reply)
Discussion started by: sollins
1 Replies

10. Solaris

read a path

Hi I'm trying to write a script in which,if i log onto a particular server,the script should automatically find the server i'm on (which is the source server).We can find it frm the path /transfer/common/utilities/env_params.txt please help me as to how start with this,shall i use the read cmmnd... (2 Replies)
Discussion started by: bkan77
2 Replies
Login or Register to Ask a Question