Hot answers tagged

7

There is no difference. From man kill: The default signal for kill is TERM. kill -s TERM <pid> does not expand the variable TERM, as kill -s $TERM <pid> would. It uses the string TERM. The correspondence between signal numbers and names are in man 7 signal. Also, from the POSIX specification of kill (my italics), -s signal_name Specify the ...


4

The kill from GNU coreutils (version 8.32 that I have installed) has a --table or -L option that outputs this information: 1 HUP Hangup: 1 2 INT Interrupt: 2 3 QUIT Quit: 3 4 ILL Illegal instruction: 4 5 TRAP Trace/BPT trap: 5 6 ABRT Abort trap: 6 7 EMT EMT trap: 7 8 FPE Floating point exception: 8 9 KILL Killed: 9 10 BUS ...


2

The effect of a backslash in the regular expression part of [[ str =~ rex ]] is to quote the following character (exactly like putting it in single quotes), which would direct bash to do a literal match for it (1). Since b is not special, \b will turn into just b, but '\', "\\" or \\ will turn into \\ in order to match a literal backslash: [[ ...


2

With bash: $ cat test foo bar baz $ content=$(<test) $ joined=${content//$'\n'/\\n} $ echo "$joined" foo\nbar\nbaz


2

You can use $'\uxxxx' or $'\Uxxxxxxxx' here (while the $'...' quotes come from ksh93, the interpretation of \u/\U in there was actually introduced by zsh, and copied by a few other shells since, though with variations). So: PS1="...."$'\ue0b2'"...." Or: myChar=$'\ue0b2' PS1="...$myChar..." or typeset -A powerline=( branch ...


2

Is duplication of the shebang (#!/bin/sh) violating any POSIX shell programming rules or guidelines? I don't believe so, no. Look at the definition for dot on the same page: The shell shall execute commands from the file in the current environment. The first line from a sourced (dot) file is not the first line of a file of shell commands because we're ...


1

Not a problem. The shebang line (#!/bin/bash) looks like a #-comment to bash. The #! is only interpreted when you start the script.


1

You can use this find command, to find and move all files with size more than 10M. find . -type f -size +10M -exec mv -t path/to/target/dir {} + Using this syntax, we use ony one mv process for all the files, or better to say, only as many processes as necessary, as in case of too many arguments, this is handled internally and a second, third etc process ...


1

With GNU awk, you could do something like: gawk ' BEGIN { n = split("alpha digit punct space", class) RS = ".{1}"; ORS = "" } { for (i = 1; i <= n; i++) if (RT ~ "^[[:" class[i] ":]]$") { print RT > (class[i] ".txt") next } print RT > "other.txt&...


1

I'm assuming that by special characters you mean non alphanumeric? If so here's what I came up with. I have a file called test which contains: 1234: 2271' 4423' 8901 1234 2569? 1234@ 5678! 9107: 1134 7896 6780 If I run cat test | tr -d '[:alnum:]' I get this output: : ' ' ? @ ! : If I want to match the alphanumeric symbols I could use this command grep -...


1

What terminal are you using? You’re asking how to change the font used by the terminal. If you’re using a terminal emulator in a windowing system (like xterm or similar), you can usually do this through a menu. If you’re on the console virtual terminal of a *nix machine, that might require compiling the font data into the kernel.


1

Not a direct answer to "can I pause in between requests", but more so for being a "good scraper citizen". I've succeeded with using the --limit-rate option after I was getting "Too many requests" from the endpoint. Had to use trial and error and 50K worked for my task. curl --limit-rate 50k "https://someURL.com/resource?p=[...


1

The best and simple way is using find. Go to the source directory. Then use the following commands. find . ! -name "*.log" | xargs -i cp -r {} ~/destination_dir This copies all files except "*.log" files.


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