In a bash script/command how can I make a PC beep noise, or play a sound file?
This will make a beep from within bash echo -en “\007”
This will make a beep from within bash echo -en “\007”
First of all, the easiest way to run things at startup is to add them to the file /etc/rc.local. Another simple way is to use @reboot in your crontab. Read the cron manpage for details. However, if you want to do things properly, in addition to adding a script to /etc/init.d you need to tell … Read more
If your lines are valid, trusted shell but for the export command This requires appropriate shell quoting. It’s thus appropriate if you would have a line like foo=’bar baz’, but not if that same line would be written foo=bar baz set -a # automatically export all variables source .env set +a If your lines are … Read more
You don’t need ${PWD} for this, you can just make the path relative and compose will expand it (one major difference between compose paths and those processed by docker run). version: ‘2’ services: couchpotato: build: context: ./couchpotato dockerfile: Dockerfile ports: – 5050:5050 volumes: – “./couchpotato/data:/home/CouchPotato/data/” – “./couchpotato/config:/home/CouchPotato/config/” As for why compose doesn’t see this variable, … Read more
Of course it does. After replacing the variable, it reads [ !-z ], which is not a valid [ command. Use double quotes, or [[. if [ ! -z “$errorstatus” ] if [[ ! -z $errorstatus ]]
From here: $@ behaves like $* except that when quoted the arguments are broken up properly if there are spaces in them. Take this script for example (taken from the linked answer): for var in “$@” do echo “$var” done Gives this: $ sh test.sh 1 2 ‘3 4’ 1 2 3 4 Now change … Read more
getTimestamp() The function you need is this one, it’s included for you already in the shell: ObjectId.prototype.getTimestamp = function() { return new Date(parseInt(this.toString().slice(0,8), 16)*1000); } References Check out this section from the docs: Extract insertion times from _id rather than having a separate timestamp field This unit test also demostrates the same: mongo / jstests … Read more
unzip -P your-password zipfile.zip man unzip -P password use password to decrypt encrypted zipfile entries (if any). THIS IS INSECURE! Many multi-user operating systems provide ways for any user to see the current command line of any other user; even on stand-alone systems there is always the threat of over-the-shoulder peeking. Storing the plaintext password … Read more
You want sed –in-place ‘s/[[:space:]]\+$//’ file That will delete all POSIX standard defined whitespace characters, including vertical tab and form feed. Also, it will only do a replacement if the trailing whitespace actually exists, unlike the other answers that use the zero or more matcher (*). –in-place is simply the long form of -i. I … Read more
If you want to trim all spaces, only in lines that have a comma, and use awk, then the following will work for you: awk -F, ‘/,/{gsub(/ /, “”, $0); print} ‘ input.txt If you only want to remove spaces in the second column, change the expression to awk -F, ‘/,/{gsub(/ /, “”, $2); print$1″,”$2} … Read more