New answers tagged

1 vote

Bash script buildscript error. Line 20: syntax error near unexpected token 'fi'

in the middle replace this : fi else echo "deployment failed" by : else echo "deployment failed" fi
  • 512
0 votes

Determine if filesystem or partition is mounted RO or RW via Bash Script?

Ubuntu has moved to snap packages which returns a lot of /snap/$package results. So my updated command is the following: grep "[[:space:]]ro[[:space:],]" /proc/mounts | grep -v /snap | grep -...
0 votes

Can't run AWS CLI from CRON (credentials)

CREATE THE FILE HERE: /root/.aws/credentials Need to be here cause for the aws cli path is always root. [default] AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXXXXXX AWS_SECRET_ACCESS_KEY=...
  • 1
0 votes

How can I display the IP address of an interface?

Works well on various linux: ip -brief address show eth0 | awk '{print $3}' | awk -F/ '{print $1}'
  • 101
1 vote

bash change directory with spaces and backslash

If you insist on using backslashed directory name in $TEST, you could try: cd "${TEST//\\/}" Explanation from man bash under the "Parameter Expansion" section: ${parameter/...
  • 111
2 votes
Accepted

How to Make the IP Address Appear as Part of Bash Prompt?

Letting your prompt actually derive that IP-address is, as far as I know, rather more difficult. Bash does not provide a ready-made variable to use for that according to the list with special ...
  • 1,143
0 votes

Curl + Socks5 - escape authentification data

Late reply, but may useful for future readers -> You can also use the data-urlencode flag like this : curl -v --data-urlencode -x socks5://user:password@PROXY_SERVER_IP:PROXY_PORT http://checkip....
  • 1
0 votes
Accepted

Scripted Password Change Does Not Survive Reboot Unless One Login Occurs - Debian 11

I have solved this problem. What is needed is a simulated login after setting the password. Nothing else is needed but the following: #!/bin/bash ## Change Root Password echo "root:$(cat /dev/...
  • 342
1 vote

How to read in N random characters from /dev/urandom?

The following command generates random characters </dev/urandom tr -dc 'A-Za-z0-9!"#$%&\(\)*+,./: ;<=>?@\[\]^_`{|}~-' | head -c 15 ; echo from all the ASCII Printable characters ...

Top 50 recent answers are included