Shell script question in special character


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script question in special character
# 1  
Old 05-20-2015
Shell script question in special character

when I execute the unix commands its works normally in the 1st part.

When I the tried the same in shell scripting the directory is not displayed in 2nd part example. please let me know what needs to be done.

Unix :

Code:
client=~zsvdbs
 
echo $client
/shome/zsvhome/zsvdbs

Using Shell script :

Code:
+ client=~zsvdbs
echo $client
+ echo ~zsvdbs
~zpsdba

I need the output as /shome/zsvhome/zsvdbs instead ~zpsdba

Please let me know wat needs to be done
# 2  
Old 05-20-2015
use $HOME in the script rather than the bash shell expansion ~
# 3  
Old 05-20-2015
You might have better luck with just: ~ as its represents $HOME, which represents /home/<yourname>.
If you want to access a sub path, try: ~/something (note the slash) or the obvious $HOME/something.

hth
# 4  
Old 05-20-2015
Re-registering to circumvent a ban is not on. Thread closed.
These 2 Users Gave Thanks to Scott For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to understand special character for line reading in bash shell?

I am still learning shell scripting. Recently I see a function for read configuration. But some of special character make me confused. I checked online to find answer. It was not successful. I post the code here to consult with expert or guru to get better understanding on these special characters... (3 Replies)
Discussion started by: duke0001
3 Replies

2. Shell Programming and Scripting

Trigger email from script if the Special Character replacement is successfull

Hello Gurus, I have a script developed... #!/bin/bash #--------------------------------------------------------------------- # This pScript will remove/replace the special characters fromfiles #--------------------------------------------------------------------- trxdate="`date... (1 Reply)
Discussion started by: nanduedi
1 Replies

3. Shell Programming and Scripting

Shell sIs there something special I need to do when using sudo in a script?

I have a script in which I used "sudo -s" I notice some extremely strange behavior when executing this script. To investigate this I decided to recreate the problem in the following script. I notice that "sudo -s" is only being executed one time. Soon after completely falls apart. Is there... (4 Replies)
Discussion started by: busi386
4 Replies

4. Shell Programming and Scripting

Question about Special Shell Variable "$-"

Question: How I can change the shell option in my current environment, which I want to change the result of the command echo $-. Background: Special variable $-. It means the current shell option, and in my ENV, the result of this command as follows. -bash-3.2$ echo $- himBH -bash-3.2$ ... (2 Replies)
Discussion started by: ambious
2 Replies

5. Shell Programming and Scripting

question about special char in script

I am reading the free book linux 101 hacks. The book show how to create a new command mkdircd, which create a new directory and then move you to the directory. so it just to add the following function (down) to the .bash_profile function mkdircd () { mkdir -p "$@" && eval cd "\"\$$#\""; }... (5 Replies)
Discussion started by: programAngel
5 Replies

6. Shell Programming and Scripting

Use arrow touch in a script shell without special character

Hello, I have a problem when i execute the script underneath. If i tape azerty 123 and i use the arrow touch, in the file /tmp/test i have the caracter #!/usr/bin/ksh clear echo "Taper l adresse IP de la partition a creer :" tput cup 1 48 read Adress echo $Adress echo "${Adress}" >>... (0 Replies)
Discussion started by: khalidou13
0 Replies

7. Shell Programming and Scripting

Deleteing one character after an special character

I have below line in a unix file, I want to delete one character after "Â". 20091020.Non-Agency CMO Daily Trade Recap Â~V Hybrids The result should be : 20091020.Non-Agency CMO Daily Trade Recap  Hybrids i dont want to use "~V" anywhere in the sed command or any other command, just remove... (1 Reply)
Discussion started by: mohsin.quazi
1 Replies

8. UNIX for Dummies Questions & Answers

Need help to escape special characters in Korn shell script

Hi, I would like to display the following message from my shell (Korn) script Copy "old_file.txt" to "new_file.txt" My code looks as follows print "Copy "old_file.txt" to "new_file.txt"" However, when I execute the script, I get the following output Copy old_file.txt to... (6 Replies)
Discussion started by: rogers42
6 Replies

9. Shell Programming and Scripting

Perl Script Syntax to Extract Everything After Special Character

Hi, I am writing a Perl script that reads in many lines, if a line meets the criteria I want to edit, it. For example, the script will return the following example line... test=abc123 All I want to do is strip off the "test=" and just be left with the abc123. In my script I can easily... (3 Replies)
Discussion started by: edrichard
3 Replies

10. Shell Programming and Scripting

Special Character Check in Shell script

Hi, I'm currently working on a project that requires parsing xml file. One of the field in the xml is shown below (don't remember exactly): <variable="ITEM">12345678</variable> I coded my script keeping in mind that the value denoted in bold will always be a number. After getting just the... (1 Reply)
Discussion started by: mradul_kaushik
1 Replies
Login or Register to Ask a Question