Linked Questions

1
vote
0answers
62 views

history - bash, dash, zsh and .profile [duplicate]

For a long time I have been wondering about the existence of many shells in GNU/Linux. To make the question a bit focused I have used only three shells - bash, dash and zsh. From wikipedia articles ...
1
vote
0answers
22 views

Shell Script Execution with Bash and without bash on command line [duplicate]

I have a shell script that reads data from a file and stores it into an array. When i execute the script like bash scriptname.sh i dont get any errors but when i execute it using sh scriptname.sh i ...
53
votes
4answers
78k views

What is the difference between ~/.profile and ~/.bash_profile?

What is the difference between ~/.profile and ~/.bash_profile?
43
votes
3answers
27k views

Where does Mac OS X come from?

Discussing with Mac owners, I got several versions of where Mac OS X comes from. It is known to have some root in BSD, but how much, and where? Some say that Mac OS X has a FreeBSD kernel, with all ...
33
votes
2answers
7k views

A layman's explanation for “Everything is a file” — what differs from Windows?

I know that "Everything is a file" means that even devices have their filename and path in Unix and Unix-like systems, and that this allows for common tools to be used on a variety of resources ...
23
votes
3answers
3k views

Are there still systems around with a /bin/sh binary?

/bin/sh, the Bourne shell created in 1977, used to be the default shell for Unix systems. Nowadays this file still exists but mostly just as a symbolic link to the default POSIX-compatible shell ...
21
votes
3answers
4k views

What is the fastest way to run a script?

I was wondering what is the fastest way to run a script , I've been reading that there is a difference in speed between showing the output of the script on the terminal, redirecting it to a file or ...
15
votes
3answers
8k views

How complex can a program be written in pure Bash? [closed]

After some very quick research, it seems Bash is a Turing-complete language. I wonder, why is Bash used almost exclusively to write relatively simple scripts? Since a Bash shell comes with Linux, you ...
11
votes
11answers
3k views

How to get the last argument to a /bin/sh function

What's a better way to implement print_last_arg? #!/bin/sh print_last_arg () { eval "echo \${$#}" # this hurts } print_last_arg foo bar baz # baz (If this were, say, #!/usr/bin/zsh instead of ...
2
votes
3answers
3k views

How can I access the history buffer in sh? (not in Bash)

Is there a command history in sh, for example how to access it, and as well, how to ensure it is clear? To clarify shells here: let's say you've logged on to a non-Gui Linux system, and $SHELL is ...
1
vote
3answers
503 views

How do I rename hundreds of files to all include the same word at the beginning of the filename? [closed]

Here is a small sample of the files I need to rename: ID_EDMSCP_20160815.txt.pgp ID_EDMSCP_20160816.txt.pgp ID_EDMSCP_20160817.txt.pgp ID_EDMSCP_20160818.txt.pgp I have ...
1
vote
5answers
100 views

IF construct in Solaris box to compare hh:mm:ss

I had created the below script which does the comparison between hh:mm:ss format variables. #!/bin/sh lag=00:00:00 MAX_LAG=00:05:00 echo $lag echo $MAX_LAG if [ "$lag" \< "$MAX_LAG" ] ##if [ "$...
1
vote
1answer
361 views

I can't get grep with regular expressions to work correctly

ssh1% cat temp sarah saab marrrrrrrrra marrrrrrrtha ssh1% grep ar*a temp grep: No match. Shouldn't this be the output? sarah saab marrrrrra I tried using putty and nxclient for Windows 10.
1
vote
1answer
138 views

FreeBSD's sh: List functions

What is FreeBSD's /bin/sh equivalent to bash's: compgen -A function which lists the names of the declared functions.