logo
Tags down

shadow

Illegal Characters in Password in Expect / Shell Script


By : user2176023
Date : October 14 2020, 02:22 PM
around this issue We are having a password which is bt67nJuse3?{]=_0!\`fr,./&##@ (Except the quotes). This password contains characters such as {, `, /, ., ! which might need to be escaped. A lot of combinations have been tried to no avail and after spending a lot of time trying to fix this issue, the following snippet is not working. , First line
code :
/usr/bin/expect << EOF
/usr/bin/expect << 'EOF'
      <<[-]word
                  here-document
          delimiter

  ...  If any characters in word are quoted, the delimiter is
  the result of quote removal on word, and the lines in the here-document are not expanded.  If word is unquoted, all lines of the here-document are subjected to parameter  expansion,
   command substitution, and arithmetic expansion, the character sequence \<newline> is ignored, and \ must be used to quote the characters \, $, and `.


Share : facebook icon twitter icon

Enter Password through bourne shell script when asked by the command without expect


By : user7849647
Date : March 29 2020, 07:55 AM
seems to work fine You can try to use sshpass tool but you will need to provide a password in clear text in your script. If that is not a problem you should use it.
code :
sshpass -p 'password'  scp /etc/clients.txt shah@192.168.1.2:/home/shah/

Read .properties file to set value in use and password field in Expect shell script


By : user3147622
Date : March 29 2020, 07:55 AM
This might help you If you can modify the format of the properties file then the easiest way would be to use the source functionality of tcl (expect script are practically tcl scripts).
code :
!/usr/bin/expect
source values.prop
spawn ssh $user@$host
expect "$user@$hosts's password:"
send "$password\n"
set user "abcd"
set password "xxxx"
#!/bin/sh
. "$1"
printf 'set user "%s"\n' "$user"
printf 'set password "%s"\n' "$password"
translate ./values.prop > values.prop.tcl

Bundle Expect with shell script to bypass installation of Expect


By : buckminsterfuller
Date : March 29 2020, 07:55 AM
I wish did fix the issue. I want to create a shell script that uses the Expect library however Expect is not installed on any of the systems where I want to run the script. I also cannot install the library on these systems either. Can I build Expect from source and then put in same directory as the script? How would you go about this? , Yes you can, and it's not difficult.
code :
gunzip expect.tar.gz
tar -xvf expect.tar
./configure --prefix=~/
make
make install

expect script + fit expect in case password not needed


By : Josh Samara
Date : March 29 2020, 07:55 AM
With these it helps You have a couple of options.
If you know what to expect from the servers you don't have to login to (e.g. session goes straight to the prompt) then add an expect statement with that:

Shell Script with sqlplus and special characters on password


By : Danilo Sanchez
Date : March 29 2020, 07:55 AM
I hope this helps you . I have a question that mix Linux / Unix shell-scripting and sqlplus (Oracle) that is driving me crazy. :-) , Configure the config file sqlnet.ora for an easy connection.
code :
NAMES.DIRECTORY_PATH= (TNSNAMES,ezconnect)
oracle@esmd:~>
oracle@esmd:~> sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 29 11:05:04 2018

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Release 11.2.0.3.0 - 64bit Production

SQL> alter user "Scott" identified by "@T!ger";

User altered.
    #!/bin/sh

    username=\"Scott\"
    password=\"@T!ger\"
    ezconnect=10.89.251.205:1521/esmd

    echo username:  $username
    echo password:  $password
    echo ezconnect  $ezconnect

 echo -e 'show user \n  select 1 from dual;\nexit;' |  sqlplus  $username/$password@$ezconnect

oracle@esmd:~> ./test_echo.sh
username: "Scott"
password: "@T!ger"
ezconnect 10.89.251.205:1521/esmd

SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 29 11:02:52 2018

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Release 11.2.0.3.0 - 64bit Production

SQL> USER is "Scott"
SQL>
         1
----------
         1

SQL> Disconnected from Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
#!/bin/sh

username=\"Scott\"
password=\"@T!ger\"
ezconnect=10.89.251.205:1521/esmd

echo username:  $username
echo password:  $password
echo ezconnect  $ezconnect
echo -e 'show user \n  select 1 from dual;\nexit;' |  sqlplus -s  $username/$password@$ezconnect

oracle@esmd:~> oracle@esmd:~> ./test_echo.sh
username: "Scott"
password: "@T!ger"
ezconnect 10.89.251.205:1521/esmd
USER is "Scott"

         1
----------
         1
#!/bin/sh

username=\"Scott\"
password=\"@T!ger\"
ezconnect=10.89.251.205:1521/esmd


echo username:  $username
echo password:  $password
echo ezconnect: $ezconnect

testoutput=$(sqlplus -s $username/$password@$ezconnect  << EOF
set pagesize 0 feedback off verify off heading off echo off;
show user
SELECT to_char(sysdate,'DD-MM-YYYY HH24:MI')||' Test passed' from dual
exit;
EOF
)

echo $testoutput

oracle@esmd:~> ./test_Upper_case.sh
username: "Scott"
password: "@T!ger"
ezconnect: 10.89.251.205:1521/esmd
USER is "Scott" 29-01-2018 11:55 Test passed
Related Posts Related Posts :
  • How to convert the processer number to 32 bit hexadecimal value
  • AWK command not working in linux but works in mac
  • Run linux command line utility from delphi app and capture output
  • Shell command that replaces event codes according to a dictionary
  • how to use shutdown call in linux using assembly programming 64-bit?
  • Where's Qt Designer on Linux installation of PySide2 (Qt for Python)?
  • How to append to a file-backed mmap using the memmap crate?
  • OpenSSL and CryptoJS SHA256 encryption conversion
  • How do I find the program process id number to kill program automatically in assembly on Linux?
  • How can i use a pre installed Intellij Idea that was installed on Windows 7 now on linux?
  • Not able to initialize variables when running as another user in shell
  • Cancel jobs running on the same partition on SLURM
  • Extract the count from a file linux
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org