Questions tagged [dash-shell]
Lightweight command-line shell, used as the default `/bin/sh` on Ubuntu
64
questions
0
votes
0
answers
15
views
Why the file /bin/sh point to dash shell but my default shell is bash? [duplicate]
When I type the command:
ls -la /bin/sh
I have this output:
lrwxrwxrwx 1 root root 4 Feb 17 12:26 /bin/sh -> dash
So the file /bin/sh is a symlink pointing to the dash shell program.
But when I ...
2
votes
1
answer
1k
views
Configure bash instead dash on Ubuntu 22.10
On a brand new Ubuntu 22.10 installation I tried the command
sudo dpkg-reconfigure dash
That he did nothing
I learned from this post that this feature has been removed.
So what is the right and clean ...
0
votes
1
answer
156
views
How to run shell script array in Ubuntu terminal?
I am learning shell script language. I write and run the code using Ubuntu terminal.I have declare an array with value like below..
arr=(1 2 3)
echo $(arr[0])
echo $(arr[1])
echo $(arr[2])
The above ...
1
vote
1
answer
263
views
is changing symlinks for "linux from scratch" harmful?
I started linux from scratch for educational purpose. In preparing section it says:
Bash-3.2 (/bin/sh should be a symbolic or hard link to bash)
Bison-2.7 (/usr/bin/yacc should be a link to bison or ...
1
vote
0
answers
650
views
Is there a startup file for dash not bash?
I put alises to .bashrc file however it doesnt sourced when it comes to /bin/sh which is linked to dash shell. Is there a compatiable version of sh terminal startup file for dash.
I have tried ....
0
votes
1
answer
116
views
i want create shell script file
I want create shell script file
in first line i want take PID for process by this command netstat -nlp | grep :3306
in second command i want kill process by kill $(PID)
but i am find this error when ...
0
votes
0
answers
283
views
How to fix "set -e -o pipefail" (CentOS script) for Ubuntu 18.04 LTS?
I'm working with a set of scripts that automate some bioinformatics (mitoVGP; https://github.com/VGP/vgp-assembly/tree/master/mitoVGP) and then the install is done as a conda environment.
The problem (...
0
votes
0
answers
125
views
Does POSIX shell (dash) officially support named character classes?
I know bash supports the so-called "named character classes" of patterns, such as [:alnum:], [:alpha:], [:ascii:] and [:digit:], but what about POSIX shell (typically dash in Ubuntu)? At ...
8
votes
1
answer
4k
views
What are syntax differences between bash and dash?
I just realized that in current Ubuntu version /bin/sh is no more symlinked to bash (as it used to be for many years), but to dash instead. I wonder what are the actual syntax differences between ...
0
votes
2
answers
3k
views
How to append text in the beginning of each line using sed
<AppendNhere> A H W C
<AppendNhere> A H W C
<AppendNhere> A H W C
Sed '/^/ i N' filename
I tried appending N using this, but it's appending N to the beginning of new ...
1
vote
0
answers
26
views
Getting hidden characters after extracting [duplicate]
I'm trying to extract value after Colon in a string which will be integer value later to compare, but I see $ and \r after extracting, so I'm not able to compare integers
Ex:
count=$(echo "...
1
vote
1
answer
5k
views
How do i use the grep command in a different directory with out using cd
I want to search for a pattern in some files but without using cd to enter the directory they are saved in. How can i do that?
0
votes
0
answers
452
views
open and save links in firefox from txt file
I have a txt file with several links (one per line) and I need to open each of these links (one at a time) in firefox, save the file and go to the next link (next line of the txt file). how can I do ...
10
votes
2
answers
16k
views
Why doesn't auto complete work in my shell?
I am not so into Linux and I have the following doubts: a client provided me an Ubuntu 18.04.3 LTS virtual machine which I access via SSH. (I am using MobaxTerm as SSH client but it should not be the ...
0
votes
1
answer
186
views
Combine JPG and MP3 to MP4 using FileManager-Actions and shell script (Ubuntu 18.04)
What I try to achieve:
Expanding my Nautilus context menu by an action to simply select a JPG-file and a MP3-file to combine them to a MP4-file like I already do in terminal by this command:
ffmpeg -r ...
2
votes
1
answer
297
views
How to list also two lines after a grep match?
grep 'STRING' filename
searches the file for STRING and lists the lines that contain a match.
How can I also list two lines that follow the match?
2
votes
1
answer
812
views
sudo with dash gives bad substitution
I tried to access a newly installed system via Emacs' Tramp the way I do it with all my other system:
C-x C-f /ssh:server|sudo:root@server:/etc/network/interfaces
This command timed out. After some ...
0
votes
0
answers
27
views
I want all my service to run through my new user
This can be a long because i am very new to this linux so please help me with this, i created a new user using sudo adduser newUser sudo now i want all my services should run through this newUser, ...
1
vote
1
answer
3k
views
Diagnose 'sh: 1: Bad substitution' from /bin/sh -exc
I've been trying to compile some ocaml packages and keep running into some errors of the form sh: 1: Bad substitution (exit code 2), eg.
/bin/sh -exc echo | m4
/bin/sh: 1: Bad substitution
But, /...
1
vote
1
answer
2k
views
Where is dash being used as default shell?
According to https://wiki.ubuntu.com/DashAsBinSh:
The default login shell remains bash. Opening a terminal from the menu
or shortcut [crtl-alt-t] provides interactive bash. A script run from
...
1
vote
1
answer
89
views
Untarring a file with limited hierarchy
I have created a tar file in terminal. Let's say I am currently in a directory test7. I am creating a tar in my current directory of a file which is inside another directory (test8).
tar -czvf ...
3
votes
1
answer
497
views
Ubuntu shell scripting [duplicate]
What is the difference between different shells in Ubuntu:
$ cat /etc/shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
7
votes
1
answer
870
views
How to concatenate two command in shell
I used to have this command to count how many times I have click with a mouse, the command is xev | grep "ButtonPress".
my colleague modify the command so that it return:
ButtonPress 0
ButtonPress 1
...
1
vote
0
answers
477
views
Why 'xargs bash -c' is far slower than 'xargs sh -c'? [duplicate]
time seq 100 | xargs -i bash -c 'echo {}'
; 2.530s
time seq 100 | xargs -i sh -c 'echo {}'
; 0.223s
why?
PS: The title of mine for this post is more intuitive to be discovered or searched by ...
3
votes
2
answers
3k
views
How do I use command-line arguments to `sh` in the `-c` command string?
I know that
sh -c 'echo $1' sh 4
will output 4.
and
sh -c 'echo $2' sh 4 5
will output 5.
But I cannot understand how the parameters after the second sh were passed to the command next to sh -c. ...
4
votes
1
answer
4k
views
update-alternatives for sh reports bash is used, but I still get dash
I just upgraded to Ubuntu 18.10 from Ubuntu 17.10.
I have my box configured to use bash as the default shell rather than the default dash. I've made this change with sudo update-alternatives --...
1
vote
1
answer
562
views
I need to insert a large string in between two pattern using shell script
I have an HTML file in that I have a comment line as:
<!-- tag1 --><!-- tag11 -->
I need to insert a JQ file element in between them.
I have tried and I was able to insert a small ...
9
votes
1
answer
27k
views
How Can I Make /bin/sh point to /bin/bash?
In Ubuntu, /bin/sh points to /bin/dash by default.
I want to use /bin/bash as my system-wide shell for /bin/sh. What is the best way to do this?
7
votes
1
answer
2k
views
Are there concrete figures on the speed of bash vs dash?
According to this article, dash was chosen as /bin/sh because bash is slower: Dash as /bin/sh
Are there concrete figures for how much faster dash is?
How much longer does it take if you use bash ...
1
vote
1
answer
362
views
Dash, command substitution not inserting newline?
Basically, this is the issue:
$ echo Hello"$(printf '\n')"World
HelloWorld
What did I overlook ?
10
votes
2
answers
1k
views
How does ~/ work? [duplicate]
In the terminal, one way to reference home is by using ~/. I don't understand how this works, because the output of file ~/ is:
/home/admin/: directory
and just running ~/ results in:
-bash: /home/...
4
votes
1
answer
660
views
fc built in missing from dash ( i.e.,dash shell history doesn't work )?
In dash manual, under Builtins section there exists explanation on fc built in which controls shell history and re-executes commands from it, FCEDIT and HISTSIZE also are mentioned there. Yet when I ...
1
vote
0
answers
548
views
Fish Shell Fatal Error : Not A Git Repository
I have been using Fish Shell for a while now, however, a day or two ago, this error started appearing on execution of every command within the shell:
fatal: Not a git repository (or any of the parent ...
1
vote
1
answer
2k
views
reading values from properties.ini and getting file not found
I keep getting
./config.sh: line 5: .: properties_DEV.ini: file not found
When running deployment.sh, I am not sure why, all three files are in the same directory.
property file contains values, ...
0
votes
1
answer
548
views
"globstar" equivalent in dash (Debian Almquist Shell)
I am using /bin/dash on a project, but I have need for **/filename.ext to have recursive behavior (i.e. globstar enabled in bash).
Is globstar available in dash? Is there a similar feature or ...
3
votes
1
answer
519
views
Ubuntu 17.10 partitions in dock
After installing ubuntu17.10 I was depressed by the fact that I can't add my partitions to the dock in order to easily mount and open them, I locked around on google, ubuntu forums and I got nothing, ...
10
votes
3
answers
2k
views
Why are numeric function names not allowed?
Consider the following:
$ ksh -c '1(){ echo hi;};1'
ksh: 1: invalid function name
$ dash -c '1(){ echo hi;};1'
dash: 1: Syntax error: Bad function name
$ bash -c '1(){ echo hi;};1'
bash: `1': not a ...
77
votes
4
answers
45k
views
What is the point of sh being linked to dash?
I am wondering what the point of sh being symbolic linked to dash is? I understand that dash is supposed to be faster than bash, but I am uncertain why the original sh shell isn't present in sh.
Or ...
1
vote
1
answer
866
views
Want to search occurance of "error" string in a log file except in some strings that has "error"(we should ignore these strings)
I want to search occurance of "error" in log file using if condition and print that error is present in log file. and if not present then should print no error found. The issue here is in my log file ...
0
votes
2
answers
2k
views
Encrypted System Partition Failed to Load on Ubuntu 17.04
I have a laptop (Thinkpad L520) with 256 GB SSD drive with Ubuntu 17.04 on it (no other operating system installed). The drive is encrypted with means of Ubuntu installation medium. One day the system ...
0
votes
2
answers
1k
views
What is an example of a generic shell script that will run correctly in the terminal but not when double-clicked?
I'd really like to understand the underlying reasons why some scripts work from the command line but not when double-clicked.
Is there an example of a script that does something simple, like ...
6
votes
1
answer
3k
views
vi editing mode in dash ( /bin/sh ) [duplicate]
TL;DR : default shell man page says there's vi editing mode, but set -o vi doesn't actually enable it
In many shells, including dash the POSIX standard dictates that set -o vi will enable vi editing ...
1
vote
1
answer
73
views
How do I write a script to rename and move a video file?
On my media server I have files that I want to automatically move and rename after they have been watched (/NewEpisodes)
I want to move those file after they have been watched to a new directory (/...
0
votes
2
answers
882
views
How to run and where to save a downloaded package on Ubuntu?
There are two ways to download a package: GUI & CLI (via terminal).
I tried the first one and can run the package via terminal only.
I want the app to appear on Dashboard and also to be findable ...
-2
votes
1
answer
63
views
Scripting a script that tests a shell [closed]
I have a custom shell and want to test its arithmetic function. I wrote a script to test it and it performs the arithmetic but it is also trying to execute the result as a program.
printf "******...
0
votes
1
answer
135
views
How can I make pasting work like yanking?
If I press ctrl+y (yank) in some programs, then the program will output what's in the clipboard to the current selected screen area. But why doesn't it work from the terminal? I would like a more ...
0
votes
3
answers
2k
views
string "if" statement comparing is string empty
I have problem checking if string is empty.
I get first column of ls -l info and try to grep string searching for "x". If string is empty, I should countinue. But whenver string is empty or not, I ...
1
vote
2
answers
9k
views
/bin/sh, /bin/bash and /bin/dash all broken, how can I install them again
Removed all /bin/sh, /bin/bash and /bin/dash. I cannot install them because dpkg and apt-get need a shell to install and there is no shell available. I'm still logged in and my Ubuntu is still running....
8
votes
2
answers
2k
views
Line editing in dash
In bash or mksh it is possible to move around the typed line word by word, using shortcuts such as ESCB.
That doesn't work in ksh or dash. As far as I understand from googling, this has something to ...
0
votes
1
answer
288
views
Ubuntu internal error /bin/dash
I am getting this error every time I boot into Ubuntu.
"Sorry, Ubuntu 14.04 has experienced an internal error"
I am suspecting it to cause an annoying hanging of terminal applications
when ...