terminal

Shell line 7: [14: command not found [duplicate]

百般思念 提交于 2019-12-20 07:49:32
问题 This question already has an answer here : shell script command not found when comparing string (1 answer) Closed 3 years ago . I don't know what is the problem to fix Here is the code: #!/bin/sh while true do HOUR=$(date '+%H') TARGET=16 echo $HOUR if [$HOUR -gt $TARGET]; then mail -s "IP" "example@hotmail.com" <<EOF Global_IP=$(curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//') EOF echo "Sent" fi echo "Waiting..." sleep 3600 echo "Done waiting" done Please help!

How can i check if no arguments are given [duplicate]

有些话、适合烂在心里 提交于 2019-12-20 07:35:33
问题 This question already has answers here : Check existence of input argument in a Bash shell script (9 answers) Closed 3 years ago . I want to check if the user has given the script any arguments and if this is the case, the script should close. if [ $@ = "" ]; then exit fi is not working. 回答1: You can try like this, if [ "$#" -eq 0 ]; then echo "Illegal number of parameters" fi 来源: https://stackoverflow.com/questions/34925224/how-can-i-check-if-no-arguments-are-given

How to modify this sed awk command so that the output goes to a file of choice?

折月煮酒 提交于 2019-12-20 07:13:35
问题 I am using the last command from this SO answer https://stackoverflow.com/a/54818581/80353 cap()(cd /tmp;rm -f *.vtt;youtube-dl --skip-download --write-auto-sub "$1";sed '1,/^$/d' *.vtt|sed 's/<[^>]*>//g'|awk -F. 'NR%8==1{printf"%s ",$1}NR%8==3'|tee cap) What this command currently do This command will download captions for a youtube video as a .vtt file and then print out on the terminal the simplified version of the .vtt file This command works as described. How to use this command In the

How is git able to run C scripts in the current directory as a command on terminal?

孤街醉人 提交于 2019-12-20 07:13:14
问题 I have been looking into bash and shell recently and been trying to work out how git is able to make a terminal command that runs C scripts in the current directory e.g git init, git push/pull etc. I have been trying to simulate it in python, by making an executable python script in my home directory, #!/usr/bin/env python import os print("current_dir: ",os.getcwd()) #prints /Users/usr/folder/script.py Then I create a .command file that calls the python script cd cd FOLDER/ python3 SCRIPT.py

Output of command in Bash script to Drop-down box?

百般思念 提交于 2019-12-20 06:19:05
问题 First off, I appreciate any and all help in answering this question. I have a command in a bash script that will output the following: 255 254 253 252 ... 7 6 5 4 3 2 1 It is a specific list of numbers, beginning with the largest (which is what I would like), then going to the smallest. The dataset is space-delimited. The output above (except including all numbers), is what you would see if you ran this command in the terminal on a linux machine, or through a bash script. I have configured my

AppleScript: how to get the current directory of the topmost Terminal

情到浓时终转凉″ 提交于 2019-12-20 06:15:05
问题 I want to get the current directory of the topmost Terminal tab/window (via AppleScript or something else, it doesn't really matter). How can I do that? 回答1: Another solution. get_foregroundterminal_curdir_fast.scpt: tell application "Terminal" do shell script "lsof -a -p `lsof -a -c bash -u $USER -d 0 -n | tail -n +2 | awk '{if($NF==\"" & (tty of front tab of front window) & "\"){print $2}}'` -d cwd -n | tail -n +2 | awk '{print $NF}'" end tell I use lsof itself to get PID of the bash shell

AppleScript: how to get the current directory of the topmost Terminal

匆匆过客 提交于 2019-12-20 06:14:04
问题 I want to get the current directory of the topmost Terminal tab/window (via AppleScript or something else, it doesn't really matter). How can I do that? 回答1: Another solution. get_foregroundterminal_curdir_fast.scpt: tell application "Terminal" do shell script "lsof -a -p `lsof -a -c bash -u $USER -d 0 -n | tail -n +2 | awk '{if($NF==\"" & (tty of front tab of front window) & "\"){print $2}}'` -d cwd -n | tail -n +2 | awk '{print $NF}'" end tell I use lsof itself to get PID of the bash shell

mac dns look up misbehaving

你离开我真会死。 提交于 2019-12-20 05:23:15
问题 Got a new mac and now I'm trying to install/update some stuff. THe first issue I get is that http requests made from inside scripts/programs (such as git or ruby gem) doesn't work. I'll put an example below of the workaround I used because it illustrates the issue better than any explanation. Any help is appreciated! Leonardos-MacBook-Air:~ leo$ git clone git://github.com/sstephenson/rbenv.git .rbenv Cloning into '.rbenv'... fatal: Unable to look up github.com (port 9418) (nodename nor

Rails / Heroku: fatal: The remote end hung up unexpectedly

安稳与你 提交于 2019-12-20 04:56:16
问题 I created a Heroku account yesterday, and uploaded a website, updating it multible times. But today when I tried to upload a new version it did'nt work, it just keeps giving me this error message: ssh: connect to host port 22: Connection refused fatal: The remote end hung up unexpectedly I tried to restart the heroku server, my own computer, create new keys using: http://devcenter.heroku.com/articles/keys If I go ssh -vvv mail@adress: OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011 debug1: Reading

Git master home directory

不问归期 提交于 2019-12-20 04:56:11
问题 I've accidentally made my home directory the master. How do I undo this? Note: every time I open up terminal now it declares that my home directory is (master). I don't want my home directory in github, just a few subfolders. Thanks! 回答1: You can remove the git directory that is hidden inside of your home directory. In the terminal enter the following: cd ~ sudo rm -R .git Note: THIS WILL REMOVE ANY GIT HISTORY FOR YOUR HOME DIRECTORY. This will not remove any files in your home directory but