Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [bash]

This challenge is related to the Bash (Bourne Again SHell) language. Note that challenges that require the answers to be in a specific language are generally discouraged.

-4
votes
4answers
217 views

tail: troll: file truncated

Background When you run tail -f file in bash, the file is outputted and then any subsequent appends. However, when you remove something that has already been ...
7
votes
1answer
433 views

Code Golfing Split String in Bash [closed]

Let us play a little golfing game. Given a single line of N space separated numbers from STDIN, one must output those numbers on N lines. So far, I came up with the three following bash solutions : ...
5
votes
3answers
405 views

Shorter way to assign a default value to the standard output stream

I have this code : tr ' ' '\n'|sort -n|head -1 The code is pretty simple, it takes a list of integer in the standard input stream (like ...
12
votes
1answer
518 views

Write a panic script to remote secure a Mac Pro from an untrustworthy local user [closed]

The Situation Suppose I allow "Shady Sam" admin access on my workstation to perform an important administrative task on my Mac Pro for me by giving them a temporary root login password. (Assume they ...
54
votes
33answers
7k views

Tips for golfing in Bash

What general tips do you have for golfing in Bash? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Bash (e.g. "remove comments" is not ...