Questions tagged [bash]

Bash is the `Bourne again Shell`, one of the more common Unix shell languages. This tag should be used for questions about editing bash scripts in Emacs, or writing bash scripts that invoke Emacs themselves. This tag doesn't necessarily apply to questions about running a shell in Emacs (which may use a language other than Bash), for which other tags are available.

103 questions
16
votes
2 answers

"cannot set terminal process group" error when running bash script

I have the following two lines of code in my init.el file: (setq shell-file-name "bash") (setq shell-command-switch "-ic") I tried executing the following script to get a list of executables using the shell script dmenu_path. (defun dmenu-path-out…
wdkrnls
  • 3,657
  • 2
  • 27
  • 46
16
votes
3 answers

Set indentation for shell script function

I am trying to set the number of spaces per indent for starting a new function in sh-mode (bash sub-mode). I have tried setting: '(sh-basic-offset 2) '(sh-indentation 2) '(smie-indent-basic 2) (as shown in custom-set-variables in .emacs) and some…
Robin Green
  • 949
  • 7
  • 16
15
votes
3 answers

Highlighting shell variables within quotes

In vim, the following document will cause the $PWD on lines 2 and 3 to be colored in two different ways: #/bin/sh echo "Current Directory: $PWD" echo 'Current Directory: $PWD' The first instance of $PWD will be in a different color from the rest of…
nispio
  • 8,175
  • 2
  • 35
  • 73
14
votes
3 answers

Git Bash in emacs on Windows

I can run the Bash shell that comes with Git for Windows. I put this in my .emacs: (defun git-bash () (interactive) (let ((explicit-shell-file-name "D:/Program Files/git/bin/bash")) (call-interactively 'shell))) Then M-x git-bash and voila,…
marczellm
  • 245
  • 1
  • 2
  • 8
13
votes
2 answers

.bash_profile or .bashrc for shell in emacs?

I wrote an alias for a huge command and stored it in .bash_profile and to my surprise, emacs didn't pick up the alias that I wrote in .bash_profile. After some searching in the internet, I created a .bashrc file in my $HOME with the alias command…
Chakravarthy Raghunandan
  • 3,132
  • 2
  • 18
  • 42
9
votes
1 answer

How to pass environment variables to org source BASH script block?

I have an org-mode file that contains a BASH script in an org-babel source block. I would like to pass environmental variable values to it through :var. something like: #+begin_src sh :var VAR1="~/foo" mkdir ${VAR1}/test or: #+begin_src sh :var…
Enze Chi
  • 1,410
  • 12
  • 28
8
votes
1 answer

How to fix "Symbol's function definition is void: org-babel-get-header"

How do you trouble shoot this? (trying to run a sh block async) #+BEGIN_SRC sh /tmp/7.sh …
american-ninja-warrior
  • 3,773
  • 2
  • 21
  • 40
8
votes
1 answer

Remote shell path - env: No such file or directory

In Emacs, when I open the file /ssh:USER@HOST:/PATH, Tramp mode kicks in and everything is great. While editing the file, I want to open a remote shell as well using M-x shell, but its behaviour is just baffling. It seems to recognize I'm in Tramp…
mk12
  • 181
  • 2
8
votes
5 answers

copy from shell and paste in terminal-emacs

How can I copy from the command line and paste in Emacs in terminal mode? If I select the text with the mouse and paste it from the clipboard with the third button (the wheel) it is OK. But if I try to run: $ emacs -nw file_name.sh (for…
Andrea Borga
  • 261
  • 1
  • 4
  • 9
7
votes
3 answers

flycheck/bash - i'd like to declare that the next line was intentional

When using the shellcheck checker, Flycheck will warn me that the "$@" in the following will be expanded on the client rather than the ssh server. Which is a helpful warning, but yeah I know and I'm good. So is it possible to suppress this…
Ben Hyde
  • 574
  • 3
  • 9
7
votes
1 answer

Help me avoid "|| true" in org babel bash statements

I'm writing a lot of manuals on how to accomplish things in bash. Often I'm showing people something that doesn't work, and then go on to show what works. When I'm showing something that doesn't work, the bash exit code is non-zero, and the result…
american-ninja-warrior
  • 3,773
  • 2
  • 21
  • 40
7
votes
1 answer

Emacs can't find Node when Node was installed using NVM

I've got Node installed using NVM, and Emacs (v25.2.1) isn't able to find Node. When I run M-: (executable-find "node") I get back nil. However, when I run M-: (executable-find "cat") I get "/bin/cat". I assume the difference is due to my use of…
user2245766
  • 281
  • 2
  • 6
6
votes
2 answers

how to set environment variables={EDITOR, VISUAL} to prefer running emacs?

my usecase I'm currently running GNU Emacs version=24.3.1 graphically (i.e., under GNOME/X though started from a script invoked from a gnome-terminal running bash) on a Debian Linux. Just now I was using commandline abcde to rip audio CDs when its…
TomRoche
  • 592
  • 3
  • 20
6
votes
1 answer

How to get the PATH from the SHELL

When launched at system start-up, the Emacs daemon doesn't pick up modifications to the PATH introduced by shell initialization scripts. Emacswiki suggests to use this function to update Emacs' PATH, (defun set-exec-path-from-shell-PATH () "Set up…
Arch Stanton
  • 1,525
  • 9
  • 22
1
2 3 4 5 6 7