Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to escape the @ character in an if statement check? Post 303043948 by mojoman on Tuesday 11th of February 2020 05:28:04 PM
Old 02-11-2020
How to escape the @ character in an if statement check?

Hi,

I am running a shell script that has to verify a password with an if statement. The password has an @ in it. I am having problems getting the if statement to test for the password. The @ causes problem. I tried the standard backslash escape but it did not work for me.
How can I do it?

I have

Code:
if [[ "$PASSWORD" != "passwordwith@init" ]]; then 
testing_code
fi

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Escape character in vi?

I want to replace a string which contains "/" in vi but what is the escape character for forward slash? e.g. I have a text file with the contents below and I want to replace "/Top/Sub/Sub1" with "ABC". /Top/Sub/Sub1 The replace command I am using is ... (4 Replies)
Discussion started by: stevefox
4 Replies

2. Shell Programming and Scripting

Escape character

Hi , I want to change space to ' in my script. I tried doing this, sed 's/ /\'/g' filename but i could not get it. can some one help me please. Thanks, Deepak (4 Replies)
Discussion started by: deepakpv
4 Replies

3. Shell Programming and Scripting

Escape character - sed

Hi All, How do i write in sed for the 6th and 7th field of etc/passwd file as it involves "/" character? Does mine below is correct? It's incomplete script as i need help with syntax as i always getting may errors :( Example of etc/passwd file: blah:x:1055:600:blah... (6 Replies)
Discussion started by: c00kie88
6 Replies

4. Shell Programming and Scripting

Escape character in sed

Hello experts I am trying to write a shell script which will add ' ' to a unix variable and then pass it to oracle for inserting to a table. I am running the script as root and I have to do a su -c . The problem is the character ' is not recognised inside sed even after adding escape... (1 Reply)
Discussion started by: pvedaa
1 Replies

5. Shell Programming and Scripting

perl how to escape (|) character

my @array; my $sepa = "|"; print $sepa; open FH, "<100_20091023_2.txt"; while(<FH>){ push @array, split(/\$sepa/, $_); print "@array\n\n"; } I am not able split the line which have | separated (1 Reply)
Discussion started by: pritish.sas
1 Replies

6. 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

7. Shell Programming and Scripting

sed - with escape character

i have string as below str=".<date>" in which i need to replace < with /< , when i tried with sed , got the output. --> echo $str | sed 's/</\\</g' .\<date> when i tried to assign it to a variable , i am not getting the same --> a=`echo $str | sed 's/</\\</g'` ; echo $a... (4 Replies)
Discussion started by: expert
4 Replies

8. 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

9. Shell Programming and Scripting

ksh escape a character

friends, I have a situation where i am using a $RANDOM function along with the filename, I want this to be escaped by the OS in the first assignment (works as expected) and executed in the second assignment (does not execute $RANDOM) filename1=filename1_\$RANDOM echo $filename1... (3 Replies)
Discussion started by: Balaji M
3 Replies

10. Shell Programming and Scripting

Function to add escape character before specified character

Hi , I am looking for a function which will do the following. 1. I have a variable which will hold few special chracter like SPECIAL_CHARS="& ;"2. I have an escape character. ESCAPE_CHAR="\"3. Now when I passed some string in the function it will return the same string but now it will... (8 Replies)
Discussion started by: Anupam_Halder
8 Replies
asadmin(1M)						    Application Server Utility						       asadmin(1M)

NAME
asadmin - utility for performing administrative tasks for the Sun Java System Application Server SYNOPSIS
asadmin subcommand [-short_option[short_option_argument]]* [--long_option[long_option_argument]]* [operand]* Use the asadmin utility to perform any administrative task for the Sun Java System Application Server. You can use this utility in place of using the Administration Console. The subcommand identifies the operation or task you wish to perform. Subcommands are case-sensitive. Short option arguments have a single dash (-); while long option arguments have two dashes (--). Options modify how the utility performs a subcommand. Options are also case- sensitive. Most options require argument values except boolean options which toggle to switch a feature ON or OFF. Operands appear after the argument values, and are set off by a space, a tab, or double dashes (--). The asadmin utility treats anything that comes after the options and their values as an operand. Local subcommands can be executed without the presence of an administration server. However, it is required that the user be logged into the machine hosting the domain in order to execute the subcommand and have access (permissions) for the installation and domain directo- ries. Remote subcommands are always executed by connecting to an administration server and executing the subcommand there. A running administra- tion server is required. All remote subcommands require the following options: -u --user authorized domain application server administrative username. -w --password password to administer the domain application server. -H --host machine name where the domain application server is running. -p --port port number of the domain application server listening for administration requests. -s --secure if true, uses SSL/TLS to communicate with the domain application server. -t --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. Default is false. -e --echo setting to true will echo the command line statement on the standard output. Default is false. -I --interactive if set to true (default), only the required password options are prompted. For security purposes, you can set the password for a subcommand from a file instead of entering the password at the command line. The --passwordfile option takes the file containing the passwords. The valid contents for the file are: AS_ADMIN_PASSWORD=value AS_ADMIN_ADMINPASSWORD=value AS_ADMIN_USERPASSWORD=value Given the --passwordfile option and its value, the password options in the passwordfile are exported to the global environment; subsequent subcommands without the password options take this value. However, if both the --password and --passwordfile options are specified on the command line, the password value in the passwordfile is exported to the global environment and subsequent subcommands without the --pass- word option would take this value. However, for the current subcommand, the --password option value specified on the command line is taken since the --password option takes precedence over the --passwordfile option. To use the --secure option, you must use the set command to enable the security--enabled flag in the admin http-listener in the domain.xml. When you use the asadmin subcommands to create and/or delete, you must restart the server for the newly created command to take affect. Use the start-domain command to restart the server. Some characters, such as the colon (:), the asterisk (*), and the backslash(, cause errors if you use them in the command syntax unless you use escape characters to set them off. The possibilities for using escape characters vary depending upon what platform you use and whether you use singlemode or multimode. You do not need to use escape characters for colons in the get or set commands. On UNIX, in singlemode, you can use either two backslashes () or double-quotes (" ") to escape restricted characters. For example, when creating a JDBC connection pool with an option whose value includes colons, you could use backslashes (example assumes the environment variables have been set for some properties): asadmin create-jdbc-connection-pool --datasourceclassname oracle.jdbc.pool.OracleDataSource --failconnection=true --isconnectvali- datereq=true --property url=jdbc:oracle:thin:@asperfsol8:1521:V8i:user=staging_lookup_app:password=staging_lookup_app OraclePoollookup To use quotes in the same example as above, you would enclose the value in double quotes (") and escape the double quotes with the back- slash. asadmin create-jdbc-connection-pool --datasourceclassname oracle.jdbc.pool.OracleDataSource --failconnection=true --isconnectvali- datereq=true --property url= word=staging_lookup_app OraclePoollookup On windows, in singlemode, you can escape using the backslash character. For example, when creating a JDBC connection pool with an option whose value includes colons, you could use backslashes (example assumes the environment variables have been set for some properties): asadmin create-jdbc-connection-pool --datasourceclassname oracle.jdbc.pool.OracleDataSource --failconnection=true --isconnectvali- datereq=true --property url=jdbcoraclethin@asperfsol81521V8i:user=staging_lookup_app:pas sword=staging_lookup_app OraclePoollookup On any platform, in singlemode, you can use backslashes to escape the character and enclose the value containing the escaped characters in double quotes. For example, when creating a JDBC connection pool with a option whose value includes colons, you could use the escape char- acters as follows (example assumes the environment variables have been set for some properties): asadmin create-jdbc-connection-pool --datasourceclassname oracle.jdbc.pool.OracleDataSource --failconnection=true --isconnectvali- datereq=true --property url="jdbcoraclethin@iasperfsol81521V8i":user=staging_lookup_app: password=staging_lookup_app OraclePoollookup On any platform, in multimode, you can use the following syntax, which only requires quotes, not slashes or backslashes: asadmin> create-jdbc-connection-pool --datasourceclassname oracle.jdbc.pool.OracleDataSource --failconnection=true --isconnectvali- datereq=true --property url="jdbc:oracle:thin:@asperfsol8:1521:V8i":user=staging_lookup_app:password=staging_lookup_app OraclePoollookup To access the manpages for the Application Server Command-line interface subcommands, add $AS_INSTALL/man to your MANPATH environment vari- able. You can obtain overall usage information for any of the asadmin utility subcommands by invoking the --help option. If you specify a sub- command, the usage information for that subcommand is displayed. Using the help option without a subcommand displays a listing of all the available subcommands. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Unstable | +-----------------------------+-----------------------------+ appclient(1M), package-appclient(1M) J2EE 1.4 SDK March 2004 asadmin(1M)
All times are GMT -4. The time now is 03:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy