Questions tagged [dash-shell]

Lightweight command-line shell, used as the default `/bin/sh` on Ubuntu

Filter by
Sorted by
Tagged with
0
votes
2answers
37 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
0answers
22 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
1answer
57 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
0answers
286 views

how to extract information and put it in the name file

I have several folders with many html files and I need to batch search for specific information within these html and insert this information in the file name as a suffix The information is: DATE | ...
0
votes
0answers
52 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 ...
5
votes
1answer
725 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
0answers
23 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 -...
2
votes
1answer
31 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
1answer
202 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
0answers
19 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
1answer
737 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, /...
0
votes
1answer
169 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
1answer
23 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
1answer
427 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
1answer
628 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
0answers
223 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
2answers
1k 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
1answer
1k 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
1answer
91 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 ...
4
votes
1answer
5k 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?
5
votes
1answer
1k 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
1answer
116 views

Dash, command substitution not inserting newline?

Basically, this is the issue: $ echo Hello"$(printf '\n')"World HelloWorld What did I overlook ?
10
votes
2answers
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
1answer
263 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 ...
0
votes
0answers
86 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
1answer
675 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
1answer
284 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
1answer
486 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
3answers
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 ...
44
votes
4answers
18k 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
1answer
109 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
2answers
1k 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
2answers
379 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
1answer
1k 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
1answer
64 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
2answers
592 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
1answer
60 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
1answer
85 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
3answers
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
2answers
4k 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....
7
votes
2answers
834 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
1answer
271 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 ...
3
votes
1answer
2k views

Dash is empty, applications do not appear

I use Unity on Ubuntu 14.04. In Dash, applications are not present. Folders&files and plugins are there though. I tried : unity --reset sudo apt-get purge unity-lens-applications unity-lens-...
1
vote
0answers
223 views

Equivalent of logname for profile

I'm getting an error when entering my session because I'm using logname in my .profile, and apparently Ubuntu doesn't like it. It says something along the lines of logname: login name not found I ...
0
votes
1answer
2k views

Terminal shows black screen Ubuntu 14.04

When I open the terminal in my Ubuntu 14.04 LTS, it shows a black window with no buttons. Nothing's visible, not even the minimise or close button. However all the commands that I type, work perfectly....
0
votes
1answer
1k views

Record screen at bootup using ffmpeg in 5 minute segments (12.04)

So I've played around with this quite a bit but at this point I've managed to hit a wall in figuring the next step. I have this script that works from an ssh tunnel to record display :0.0 #!/bin/...
3
votes
1answer
579 views

What's the difference between system shell and login shell?

I recently encountered that my /bin/sh is a symlink to dash, which is apparently default system shell for ubuntu since its 6.10 release. I didn't know system shell is different from login shell. I ...
1
vote
1answer
1k views

Solving $PATH obfuscation by /bin/sh (dash)

This question is a follow-up from https://unix.stackexchange.com/questions/126955/percent-in-path-environment-variable. I post it here, since it is more distro-specific. The shell used by default for ...
-2
votes
1answer
739 views

How to make a shell script pipe aware

I have the following script: #!/bin/sh [ "${#}" -eq "0" ] && (printf "%s\\n" "${0}: word ..." >&2; exit 1) _whats() { [ -z "${1}" ] && return 1 [ -z "${2}" ] &&...
1
vote
2answers
314 views

command line not working

after I initially installed ubuntu , I can run 'll' in my terminal. But after I checked a "Run command as login shell" in terminal preferences I cannot run "ll" command any more in terminal. ...