Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 128228

The shell is Unix's command-line interface. You can type commands in a shell interactively, or write scripts to automate tasks. Use this tag for questions applying to /bin/sh and most compatible shells (ash, bash, ksh, zsh, …). For shell scripts with errors, please check them in http://shellcheck.net before posting here.

1
vote
Buffering might also be disabled by fiddling around with PerlIO layers (see also perlrun). Also, that awkward and verbose C-style loop can be more easily written as ... for 1..10 or for my $i (1..10) …
answered Apr 8 '16 by thrig
1
vote
This might be better done with a script that can show the time remaining when bonked with a QUIT (usually control+\) or INFO signal. #!/usr/bin/env perl # # snooze - sleep for a given duration, with …
answered Oct 5 '16 by thrig
5
votes
Unix programs may have an -i inplace switch (e.g. older version of sed do not, but most now do having stolen that flag from perl), check the man page for details. This will usually cause the program t …
answered Apr 19 '17 by thrig
2
votes
Another option is to embed literal newlines in the script: % cat newl blah='x y z' echo "$blah" % sh newl x y z % Do note the quotes on $blah!
answered Jul 5 '16 by thrig
0
votes
Either will work if the command supports reading from standard input (the command <file form) or from a named file in the argument list. Even tcsh supports command <file so that syntax is fairly porta …
answered Oct 25 '16 by thrig
0
votes
There are control sequences that can change the size (and placement) of a terminal, e.g. alias term-norm='printf "\033[8;24;80t"' alias term-tall='printf "\033[8;0;80t"' or in detail ESC [ Co …
answered Jun 28 '17 by thrig
4
votes
echo my input string | ./program_name Or, if you are a quotist: echo "my input string" | ./program_name Another handy tip is a subshell to collect output from multiple sources, for example: ( ec …
answered Sep 28 '15 by thrig
12
votes
to be the name of a file containing shell commands. Does ls contain shell commands? No, it is a binary file. bash squawks about this fact and fails. A strace may help show what is going …
answered Feb 3 '17 by thrig
1
vote
-bash-4.2$ alias b='cd ..' -bash-4.2$ function nope() { :; } -bash-4.2$ complete b -F nope -bash-4.2$ b So completing on the nope function appears to disable completion. Can we improve on this? -b …
answered Jan 31 by thrig
5
votes
You can put the following lines in your vimrc to quit vim if any of its arguments are a directory: for f in argv() if isdirectory(f) echomsg "vimrc: Cowardly refusing to edit directory " . f …
answered Jul 23 '16 by thrig
18
votes
output is similar to that for the XTRACE option, with the message <sourcetrace>.  A file may be loaded by the shell itself when it starts up and shuts down (Startup/Shutdown Files) or by the use of the ‘source’ and ‘dot’ builtin commands. …
answered Aug 28 '15 by thrig
0
votes
At the cost of some extra filesystem operations limit the search to plain files. This will exclude the exclude directory because that's not a file: find . \( -name '*.c' -o -name '*.h' -o -path '*/ex …
answered Aug 1 '17 by thrig
5
votes
Problems include motor memory if then on somebody else's system where that alias is not setup and then something bad happens as you were expecting rsync but cp happened instead (trailing slashes or la …
answered Jul 19 '16 by thrig
0
votes
One could treat the file as a single string, then only replace newlines that are followed by two newlines. This solution assumes non-blank lines. bash-4.1$ cat input duck duck duck -- goose bash-4 …
answered Feb 12 '16 by thrig
0
votes
shell such as ZSH that does not do the POSIX word split thing. % mkdir "a dir" % dir="a dir" % cd $dir % pwd /Users/jhqdoe/tmp/a dir % cd .. % bash bash-3.2$ dir="a dir" bash-3.2$ cd $dir bash: cd: a: No such file or directory bash-3.2$ exit exit % …
answered Mar 15 '18 by thrig

15 30 50 per page