-bash: unalias: emacs: not found - bash

I followed some advice on how to remove an alias and run unalias on it. Now every time I open up a shell I get this message :
-bash: unalias: emacs: not found
Please help!

It would seem that you've put unalias emacs in a script that runs each time you log on - perhaps in ~/.bashrc. Each time you log in, it's trying to run the unalias command when the alias has already been removed. Try removing this command from any startup scripts and see if that fixes your problem.
If you can't find where you put the unalias command, you can try grep'ing through your file system, but it may take a long time: grep -rn / -e "unalias emacs" 2>/dev/null
Happy hunting!

Related

Failing to run external Bash program — /usr/bin/bash: bad interpreter: No such file or directory

I'm trying to run a CLI tool in Linux (Mint) which allows me to edit subtitles. It is named subedit: github link. In order to run it, I've added executable permission with chmod +x and added it to the path in bash. However, when I run it, I get the following error message:
bash: /home/main/Documents/shellTools/subedit/subedit: /usr/bin/bash: bad interpreter: No such file or directory
I'm not very experienced with external bash programs and forgot to do something that would be obvious in hindsight.
When I do echo $PATH this is the output:
/home/main/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/main/Documents/shellTools/subedit/
Could somebody please help?
Assuming bash is installed, (it usually is), change the first line of subedit from:
#!/usr/bin/bash
to:
#!/bin/bash
Or if one would prefer not to edit subedit, try this one-liner covering what Al-waleed Shihadeh suggested:
ln -s "$(which bash)" /usr/bin/bash
It seems that you don't have bash installed, you can verify that by running
which bash
if the above command returns "bash not found", then you need to install it.
In case the above command returns a path, you can use the below command to add a symlink to the expected path
ln -s $(path from the above command) /usr/bin/bash
Use the command termux-chroot ONCE!
If you want to always run at the start of a session, be sure to check if it was never run before.
if [ -z $CHROOT ]; then
CHROOT=1
termux-chroot
fi

ubuntu : how to clear $SHELL history

No command 'exprt' found, did you mean:
Command 'expr' from package 'coreutils' (main)
exprt: command not found
i got this msg everytime i open the terminal. 'exprt' is my typo error during installation. I've tried
# history -c
# history -cw
but it still can't get rid of this problem, especially when
# exec $SHELL
it prompt the same error as well
any solution? I'm newbie to ubuntu...
Could this just be a typo in one of your shell configuration files?
Try running the following to search your .profile, .bash_profile, .bashrc, and so on for the offending line:
grep 'exprt' ~/.*
If you find the typo, edit the line so that is says "export" instead of "exprt", if that is what it should be.

Unable to successfully execute some commands in Cygwin

I installed Cygwin64 in my 64-bit Windows 7 machine. The following commands failed executing, however, by displaying the error messages below. Could you help providing a resolution please?
$ ll
-bash: ll: command not found
$ clear
-bash: clear: command not found
However, the command ls -l worked...
$ ls -l
total 0
Also i tried by un-commenting the following line in .bashrc file in my home dir -
# alias ll='ls -l'
But it didn't help either!
After you uncomment the alias, you should start a new Cygwin shell for it to take effect. The .bashrc file is actually a script that is sourced when bash starts.
clear is not a Cygwin (Unix) command. Just use Ctrl-L instead.

Unknown bash scripts running when terminal opens?

I am not exactly sure what's happening here - I open a terminal window on my mac and see the following:
Last login: Tue Jun 26 00:36:08 on ttys002
-bash: : command not found
-bash: : command not found
This seems to me like some file is being executed whenever I open a new terminal window, but I have no idea how I'd find this file. Is there some list of files that run when terminal opens that I could find easily? I'd love to know what is happening here (and how it came about in the first place)
grep Sorry $(grep -l Thank /etc/profile /etc/bash* ~/.bashrc ~/.bash_profile ~/.profile) /dev/null
And (when you are lucky) you will find the places where are these strange commands with Thank and Sorry.
It is possible although does these lines are produced during some command substitution.
In that case you will not find the strings. I would recommend then add set -x to ~/.bash_profile to find the string that produces these messages.
Check .bashrc, .profile and .bash_profile. Specifically, I have a feeling you have a String marked with inverted commas, which is then being tried to execute
From the bash manual:
When bash is invoked as an interactive login shell, or as a
non-inter‐
active shell with the --login option, it first reads and executes com‐
mands from the file /etc/profile, if that file exists. After reading
that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
in that order, and reads and executes commands from the first one that
exists and is readable.

How can I use mvim to edit my crontab on Mac OS X (10.6.6)

mvim is installed in /usr/local/bin/ but can not be used as either EDITOR or VISUAL:
$ mvim -f # works as expected
$ EDITOR="/usr/local/bin/mvim -f" crontab -e
crontab: /usr/local/bin/mvim -f: No such file or directory
crontab: "/usr/local/bin/mvim -f" exited with status 1
I tried single quotes and using VISUAL instead of EDITOR. Same result. I also tried googling, but apparently the -f flag works just fine for everybody else.
I use Mac OS 10.6.6 and zsh, but the problem is the same in bash.
The problem is crontab expects to be able to run a program called "/usr/local/bin/mvim -f" if you supply that in the EDITOR environment variable.
To get around that, you could write a short shell script. For example, call this one mvimf:
#!/bin/bash
/usr/local/bin/mvim -f "$#"
Then you can run: EDITOR=/usr/local/bin/mvimf crontab -e
I am not sure if this is directly related to the problem you are having but I was seeing a similar error code when trying to edit my crontab. I realized I had a little conflict in my vimrc file related to the pathogen plugin. If you call:
filetype off
when it's already off you can cause problems that will make your Vim exit with errors. Sounds like your issue is fixed already, but since this shows up in searches related to this error code, I thought I would post it here.
Credit goes to commenters on this post - http://tooky.github.com/2010/04/08/there-was-a-problem-with-the-editor-vi-git-on-mac-os-x.html
For those seeing this without mvim, you can use morton-fox's answer for any editor:
EDITOR=/usr/bin/vim crontab -e
Will use vim to open the crontab file

Resources