Tag Info

Hot answers tagged

3

Is it because no new files have been downloaded,[...]? Yes. That's it. There will be no summary if zero bytes have been downloaded. It's because of the second half of the if-statement below: "total_downloaded_bytes != 0" Source from the wget Git repo: if ((opt.recursive || opt.page_requisites || nurl > 1 || (opt.input_filename ...


3

In XTerm (or anything that emulates it), it sets the window's title to "Hello World". \e] is the ASNI escape code for an "operating system command" (OSC), which essentially means it's up to the operating system to define what it means; in XTerm, <OSC>0;text<bel> is used to set the window title. See wikipedia, and Edward Moy's XTerm sequence list ...


2

With GNU grep: echo 'Hi! Hi, same word twice twice, as as here here! ! ,123 123 need' | grep -Eo '(\b.+\b) \1' Output: twice twice as as here here 123 123


2

-n prevents echoing a new-line at the end. $' is a Bash command that causes backslash-escaped characters in the string to be replaced as specified by the ANSI C standard. More info \e = ESCape. \e]0; is a command to set the window's title, in this case to set it to "Hello World" More info on *nix Echo here


2

In general terms, these lines are user-scoped variables used by applications that you may run. The top two settings appear to be used by the X-Server system. The values may be hard coded, or they may point to a file that contains the information required. SSH_Auth_Sock is used by OpenSSH for passwordless (key based) authentication. It is my supposition ...


1

This intrigued me, so I had a go at it, here's my code: #!/bin/bash startIFS=$IFS IFS=$'\n' function echocount { dirs=$(find -type d) for f in $dirs; do c=$(find "$f" -maxdepth 1 -type f | wc -l) ; echo "$c $f"; done } echocount | sort -n IFS=$startIFS I find this very stupid and annoying in shell scripting, but I need to change the IFS so that ...


1

less also recognizes start-of-line anchor ^ and greedy matching operator *. man -P "less '+/^ *'pushd" bash manbb() { man -P "less '+/^ *'${1}" bash } manbb pushd


1

How about this command? tac file| awk '/---/ {exit} {print}'|tac On OSX just replace both tac commands with tail -r From man tac: tac - concatenate and print files in reverse - reverse of cat command ;) Output of tac file: next line this is a test to add some extra content --- draft: true title: dont't know --- The awk command awk '/---/ {exit} ...


1

How about a function in you .bash_profile scps () { if [ -f $1 ] ; then scp $1 davea@proxy:/home/davea && ssh davea@proxy && scp $1 davea@server:/home/davea else echo "'$1' is not a valid file!" fi } Then you can use scps filename to copy filename to davea@server:/home/davea.


1

Try this way: if [[ VAR=$(netstat -tan | awk '/:1234/ && /ESTABLISHED/{n++} END {print n+0}') -gt 2 ]]; then echo $VAR; fi


1

iptables -A FORWARD -d 2.2.2.2 -i eth0 -p udp -j ACCEPT -A --append = Will add one or more rules to the end of the selected chain FORWARD = will forward the traffic -d = Destination IP -i = Interface -p udp = Protocol for udp -j = Specifies the target of the rule Hope this helps!


1

You could create a function like that: sshx () { ssh "machine$1" -l root } Then you should execute sshx 1



Only top voted, non community-wiki answers of a minimum length are eligible