How to read a file into a variable in shell?

In cross-platform, lowest-common-denominator sh you use: #!/bin/sh value=`cat config.txt` echo “$value” In bash or zsh, to read a whole file into a variable without invoking cat: #!/bin/bash value=$(<config.txt) echo “$value” Invoking cat in bash or zsh to slurp a file would be considered a Useless Use of Cat. Note that it is not necessary to … Read more

How to download a file from server using SSH? [closed]

In your terminal, type: scp your_username@remotehost.edu:foobar.txt /local/dir replacing the username, host, remote filename, and local directory as appropriate. If you want to access EC2 (or other service that requires authenticating with a private key), use the -i option: scp -i key_file.pem your_username@remotehost.edu:/remote/dir/foobar.txt /local/dir From: http://www.hypexr.org/linux_scp_help.php

How to determine the current interactive shell that I’m in (command-line)

There are three approaches to finding the name of the current shell’s executable: Please note that all three approaches can be fooled if the executable of the shell is /bin/sh, but it’s really a renamed bash, for example (which frequently happens). Thus your second question of whether ps output will do is answered with “not … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)