The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
3answers
371 views

Proper place to put shell prompt(PS1) when use sh/bash/zsh together

I'm using dash(sh) or bash or zsh. If possible, I would prefer to put in common place. I want to put proper PS1 settings when I interactive with shell, so these situation should be considered login ...
2
votes
1answer
56 views

Where do I place commands to automatically be exported for all users?

I have an embedded platform running an Arago linux distribution. Right now the only "user" is root but there will eventually be others, but I don't know how many or what user IDs they will have. ...
0
votes
1answer
73 views

Can I use an if statement to detect if bash and dash are being run interactively? [duplicate]

After looking around for a while I've found several good pages describing how to check and see if a bash script is running interactively and there seem to be several methods, but one of them that I ...
36
votes
4answers
4k views

Why does no one use the true Bourne shell as /bin/sh?

I've noticed that basically no system I've ever worked with has /bin/sh as a real executable. It's always a symlink to dash, bash in POSIX mode, or something similar. Why? What are the disadvantages ...
1
vote
2answers
43 views

Nightly show as Firefox in Dash

I have created the following .desktop file in ~/.local/share/applications, when I search "Nightly" Nightly appears in search results with the correct icon(earth at night), but when I opened it it ...
5
votes
3answers
139 views

/bin/dash syntax

I have following bash command diff <(xzcat file1.xz) <(xzcat file2.xz) and I need to execute it in dash. On my system (Debian Wheezy), dash is the default interpreter for cron (/bin/sh is a ...
1
vote
1answer
197 views

Can't access command history in my shell (sh)

I'm not sure if readline is what really missing but the problem is shell (instead of bash) and when I click the up and down arrow I get the following instead of command history: $ ...
1
vote
3answers
2k views

How to know which is the default script shell in Centos?

I'm using Centos 6 and after reading about different shells and dash implementasion as sh replacement in Debian, Ubuntu and Fedora, made up my mind to replace sh with dash as the script shell in ...
2
votes
1answer
54 views

What is happening when a script encounters an error in one of the commands?

I used alien to convert an RPM to a .deb. I did NOT use alien's script conversion; I'm converting by hand. Indeed, the script did barf on some non-compatible syntax. My question is NOT about how to ...
2
votes
2answers
623 views

Calling bash from sh (dash) with commands read from args, and “Unterminated quoted string”/“unexpected EOF”

Just thought I'd document this: I'm trying something very simple - set env variable in bash, and print it out: $ bash -c "a=1; echo a$a;" a $ bash -c "a=1; echo a\$a;" a1 Now I'd want this same ...
0
votes
1answer
510 views

POSIX and Bash, sh shorthand, for compound if statement

I prefer to do my sh commands in shorthand, And I prefer to be in POSIX. Truthfully, if the script can run on Dash, that is good enough. Which means using the test command [, not the extended [[. I ...
11
votes
2answers
580 views

What is the difference between : and true?

In bash: $ type : : is a shell builtin $ type true true is a shell builtin Looks like they are the same, but they don't give the same system trace: $ strace : strace: :: command not found $ strace ...
0
votes
1answer
422 views

Login script for bash not loading

I am very confused about the login script for bash. I have always used ~/.bash_profile to configure my bash shell. Now I am on a new system just as a user: I am not root. This system was originally ...
5
votes
2answers
724 views

Will I be able to build LFS using dash and mawk?

I decided that I want to learn more about Linux and try building LFS. I'm using Ubuntu 11.04 as host system and Ubuntu uses dash and mawk by default. I've changed mawk to gawk, but considering that ...
4
votes
2answers
631 views

Get line number in a Bourne shell script

I'd like to be able to print the current line number in a shell script. I know about the $LINENO variable in Bash shells, but it doesn't seem to exist in Bourne shells. Is there any other variable ...
2
votes
2answers
869 views

When sh is a symlink to bash or dash, bash limits itself to POSIX-compliance, so it should be 100% compatible with sh?

From Difference between bash and sh: ABck to the question: If you have /bin/sh as a link to bash, then bash will not behave the same when called as /bin/sh as it does when called as /bin/bash. ...
6
votes
1answer
722 views

Are dash, ash and sh script 100% compatible?

I wanted to know whether scripts written for dash, ash, and sh are 100% compatible? Are there any added features to dash or ash, or syntax change? From what I heard, ash is a direct descendant of ...
5
votes
1answer
1k views

A couple arithmetic related commands, Dash, POSIX shell, sh, Increment

When pre/post incrementing a variable, in POSIX Shell, what is the difference between these two examples. They seem like they would have the same consequences, but would they be used differently? ...
4
votes
1answer
361 views

In a script, check if standard input comes from a file or pipe

I know this has been poorly covered previously, but those answers either lack explanation or don't apply. Basically at some point my scripts needs check if a file is specified, if it was it will be ...
0
votes
3answers
2k views

Why does this incrementing for loop return a bad variable?

I'm trying to call this shell script from within the CLI of GRASS GIS: for (( day=5; day<367; day+5 )); do # commands that I've tested without a loop. done exit 0 returns Syntax error: Bad ...
0
votes
1answer
1k views

How to pkill from a script?

How can I write a script that basically just runs pkill -HUP inetd? I want to restart inetd via a script so I can schedule it to run at a particular time. I tried to write it myself, but I'm getting a ...
2
votes
4answers
1k views

Shell script error message

I am trying to learn shell scripting by reading linuxcommand.org. For some reason I keep getting the error "Not Found", even though it runs all the commands. The error codes I get are: ...
3
votes
2answers
461 views

Getopts option processing, Is it possible to add a non hyphenated [FILE]?

I'm using getopts for all of my scripts that require advanced option parsing, and It's worked great with dash. I'm familiar with the standard basic getopts usage, consisting of [-x] and [-x OPTION]. ...
4
votes
2answers
357 views

Can I trace a dash script without modifying its source code?

I would like to trace a shell script for debugging purposes without having to modify its source code (e.g. change the shebang or insert a set -x at the beginning). It is a dpkg postinst script, so not ...
1
vote
1answer
150 views

How does this bash function work?

I'm looking at this short example, and I don't see how this function works: function EXT_COLOR () { echo -ne "\[\033[38;5;$1m\]"; } AFAIK -ne stands for not equal. What are we comparing here? I ...
4
votes
2answers
706 views

dash compatibility to bash

Wikipedia says that dash executes faster than bash. My question is, if I set /bin/sh to dash, will all scripts that use /bin/sh in their shebang line that was intended for bash work under dash?