Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Escape bash-special character in a bash string Post 303031784 by arcoa05 on Tuesday 5th of March 2019 08:35:35 PM
Old 03-05-2019
Escape bash-special character in a bash string

Hi,

I am new in bash scripting. In my work, I provide support to several users and when I connect to their computers I use the same admin and password, so I am trying to create a script that will only ask me for the IP address and then connect to the computer without having me to type the user and password.

Here's the script:
Code:
read -p "Enter ip address: " IP_ADDRESS
pss="123@456"
open vnc://test:$pss@$IP_ADDRESS

If I remove the @ from my password I am able to connect with no issue. I have tried to escape the @ by adding a backslash before the character but still not working (e.g. 123\@456). Do you guys have any suggestions?..

Thanks in advance.




Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 03-06-2019 at 04:18 AM.. Reason: Added CODE tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

bash script to check the first character in string

Hello would appreciate if somebody can post a bash script that checks if the first character of the given string is equal to, say, "a" thnx in advance (2 Replies)
Discussion started by: ole111
2 Replies

2. Shell Programming and Scripting

Printing special character in bash

I am using this character as a delimiter 'þ' Currently, I set it straight: DELIMITER='þ' However, while copying the file, this character often gets mangled. Is there a bash way (perhaps using tr or printf) of generating this character. It corresponds to "chr(0xfe)" if using perl. (I've... (6 Replies)
Discussion started by: sentinel
6 Replies

3. Shell Programming and Scripting

Bash - get specific character from the string

Hi! If I want to extract a character from a specific position of a string, I can use ${string:1:1} (if I want character at the position 1). How can I do the same thing, when the number of position is contained in the variable? ${string:$var:1}doesn't work, unfortunately. Thanks in advance. (2 Replies)
Discussion started by: xqwzts
2 Replies

4. Shell Programming and Scripting

Bash: How to remove the last character of a string?

In bash, how can one remove the last character of a string? In perl, the chop function would remove the last character. However, I do not know how to do the same job in bash. Many thanks in advance. (12 Replies)
Discussion started by: LessNux
12 Replies

5. Shell Programming and Scripting

Regex escape special character in AWK if statement

I am having issues escaping special characters in my AWK script as follows: for id in `cat file` do grep $id in file2 | awk '\ BEGIN {var=""} \ { if ( /stringwith+'|'+'50'chars/ ) { echo "do this" } else if ( /anotherString/ ) { echo "do that" } else { ... (4 Replies)
Discussion started by: purebc
4 Replies

6. Shell Programming and Scripting

Escape special character

Hi, How to use * in call to pl/sql block from shell script? The line "select * from" is causing all files and directiores to show up in email notification but if I give all column names then it works, Please let me know how to use '*' instead of giving all column names, in other wirds how to... (2 Replies)
Discussion started by: sandy162
2 Replies

7. UNIX for Advanced & Expert Users

Escape special character

My input is: jdbc:Oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.147.109.211)(PORT=1526))(CONNECT_DAT A=(SID= MWDBD22))) In the search pattern, ( and ) and . and @ are special RE, and need to be escaped \( and \) and \. and \@ how can i do it by script or command (9 Replies)
Discussion started by: arindam guha
9 Replies

8. Shell Programming and Scripting

Match string against character class in bash

Hello, I want to check whether string has only numeric characters. The following code doesn't work for me #!/usr/local/bin/bash if ]]; then echo "true" else echo "False" fi # ./yyy '346' False # ./yyy 'aaa' False I'm searching for solution using character classes, not regex.... (5 Replies)
Discussion started by: urello
5 Replies

9. Shell Programming and Scripting

Bash: Pulling first and last character in string

I am writing a bash script that will find all references to the “Well_List” in the “Comp_File”. I am filtering a Well_List that contains the following: TEST_WELL_01 TEST_WELL_02 TEST_WELL_11 TEST_WELL_22 GOV_WELL_1 GOV_WELL_201 PUB_WELL_57 PUB_WELL_82 . . Comparison... (5 Replies)
Discussion started by: petfyp
5 Replies

10. 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
xrdp.ini(5)															       xrdp.ini(5)

NAME
xrdp.ini - Configuration file for xrdp(8) DESCRIPTION
This is the man page for xrdp.ini, xrdp(8) configuration file. It is composed by a number of sections, each one composed by a section name, enclosed by square brackets, folowed by a list of <parameter>=<value> lines. xrdp.ini is contains a [Globals] section, which sets some global configuration settings for xrdp(8), and one or more "connection" sections which contain the info on which services xrdp(8) can connect to. All options and values (except for file names and paths) are case insensitive, and are described in detail below. GLOBALS
The options to be specified in the [Globals] section are the following: bitmap_cache=[0|1] If set to 1, true or yes this option enables bitmap caching in xrdp(8) bitmap_compression=[0|1] If set to 1, true or yes this option enables bitmap compression in xrdp(8) CONNECTIONS
A connection section is made of a section name, enclosed in square brackets, and the following entries: name=<session name> The name displayed in xrdp(8) login window's combo box. lib=../vnc/libvnc.so Sets the library to be used with this connection. username=<username>|ask Specifies the username used for authenticating in the connection. If set to ask, user name should be provided in the login window. password=<password>|ask Specifies the password used for authenticating in the connection. If set to ask, password should be provided in the login window. ip=127.0.0.1 Specifies the ip address of the host to connect to. port=<number>|-1 Specifies the port number to connect to. If set to -1, the default port for the specified library is used. EXAMPLES
This is an example xrdp.ini: [Globals] bitmap_cache=yes bitmap_compression=yes [vnc1] name=sesman lib=../vnc/libvnc.so username=ask password=ask ip=127.0.0.1 port=-1 FILES
${XRDP_CFG_DIR}/xrdp.ini SEE ALSO
xrdp(8) sesman(8) sesrun(8) sesman.ini(5) for more info on xrdp see http://xrdp.sf.net xrdp team 0.1.0 xrdp.ini(5)
All times are GMT -4. The time now is 06:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy