This question already has answers here:
How can I escape an exclamation mark ! in cmd scripts?
(4 answers)
Closed 3 years ago.
All,
I have a script that is using plink to connect to ~300 routers. I last used it to update a password for an admin account. Short is, password containing ! is failing.
I can SSH to the router with the password containing ! just can't connect using plink. I have tried replacing ! with %21. Tried escaping with ! and ^!. Nothing is working.
Thoughts?
Yea, that was a lot of nonsense to end-up with double ^
So. Escape ! with ^^
Example
plink -pw abc^^!
Related
im trying to create specific pattern for creating password via crunch but didnt found anywhere somthing like that and wanna now if it even possibale.
for example i want to make as pattern thw word "password" but i want that the letter p could be lowcase or highcase, and the letter a could be a or # and the s could be s/$.
so i try somthing like
crunch 10 10 pP+a#+s$word -t
but it not seems right.
try to lock allready in bunch of guide but didnt found way to make spesific char to been choseen from a spesicifc option.
any suggestion?
thank you
crunch 8 8 pP a# s$ s$ -t #,^^word
Gives the output:
password
pas$word
pa$sword
pa$$word
p#ssword
p#s$word
p#$sword
p#$$word
Password
Pas$word
Pa$sword
Pa$$word
P#ssword
P#s$word
P#$sword
P#$$word
If you want to write to a file, append this at the end: -o file.txt
when I try to run the command create role new_user with passowed 'passowrd' login; it just gives me postgres'> on a new line. I am logged in as a superuser in aws postgres rds. what does this mean and how do I fix this?
That means that your typing on the command line is as sloppy as your typing in Stackoverflow, and you didn't close the single quotes properly. Now psql is waiting for you to continue the string input.
Reset the query buffer by hitting Ctrl+C and start again, taking care that you balance the quotes.
Perhaps the password contains a single quote, which you would have to escape by doubling it.
Let me remark that setting a password like this is unsafe: the password is visible on your screen, will end up in your history file, is sent over the line in clear text and may end up in the PostgreSQL log. Use \password to set the password, then you also don't have to worry about escaping single quotes.
This question already has answers here:
Capturing multiple line output into a Bash variable
(7 answers)
When to wrap quotes around a shell variable?
(5 answers)
Closed 5 years ago.
I have shell script as below
query="SELECT * from [myDB.myTable]"
echo $(date +"%Y-%m-%d %H:%M:%S")'|'land'|'Failure'|||'twice'|'$query > test.log
When I run above in some directory in my Unix PC, the test.log shows the result as below
2017-12-13 06:54:03|land|Failure|||twice| SELECT temp1.txt test tmp.log tt.sh from [myDB.myTable]
Actually I wanted query to be redirected as it is in the log file, instead it printed all the file names of that directory.
How can I fix this issue?
The dreaded pathname expansion strikes again! You can attribute that list of filenames to having a * in an unquoted expression.
echo "$(date +'%Y-%m-%d %H:%M:%S')'|'land'|'Failure'|||'twice'|'$query" > "test.log"
# ^ ^
cat "test.log"
> 2017-12-13 06:54:03|land|Failure|||twice| SELECT * from [myDB.myTable]
Use double quotes for your complete echo, the single quotes can be deleted:
echo "$(date +"%Y-%m-%d %H:%M:%S")|land|Failure|||twice|${query}" > test.log
I also have put curly braves in ${query}, that is not a solution for your problem but a good habit for future scripts.
This question already has an answer here:
Why is terminfo[kcuu1] = '\EOA'?
(1 answer)
Closed 5 years ago.
I'm using xterm. If I type infocmp $TERM | grep end, I see that kend=\EOF. However, if I type read, and then the End key, I see that the sequence \E[F is generated. This seems to be a problem with other keys, too.
Surely the values should be identical??
The terminal can be set on a special mode to send keystrokes from the keypad. You can set that mode by running tput smkx and unset it by tput rmkx.
I'm trying to write some code to work with an htdigest password file. The documentation I can find seems to claim that the format of that file is:
user:realm:MD5(user:realm:pass)
If that is the case, then why doesn't this work for me? I created a file with the command line htdigest thus:
htdigest -c test b a
When prompted for a password I entered 'c'. This creates a file with the contents:
a:b:02cc8f08398a4f3113b554e8105ebe4c
However if I try to derive this hash I can't,
echo a:b:c | md5
gives me "49d6ea7ca1facf323ca1928995420354". Is there something obvious that I'm missing here?
Thanks
echo by default adds a trailing new line:
echo -n a:b:c | md5
Should work as you expect.
Hm, I seem to have answered my own question. My test case was flawed, 'echo' is adding extra characters (not sure which). For instance
echo a:b:c | wc
gives 6 characters instead of 5. Calculating the hash at http://md5-hash-online.waraxe.us/ gives the correct value. Sorry everyone!
Here is how you set the password for a given user.
sudo htdigest /etc/apache2/.htdigest yourrealm.com yourusername