Bash это каталог ошибка

This is really confusing…

I currently have a Debian 8 computer, and I connect to it using PuTTY (SSH).
The default console used is Bash.

When I try to pass a path to an alias, it gives the following error:

 -bash: /: Is a directory

Here is an example:

putty

Also, there’s a bizarre behaviour: running '/' or "/" cause the same error, as if Bash were ignoring quotes.


If it matters, the alias explorer was defined like this:

alias explorer='pcmanfm 1>/dev/null 2>&1 &'

Is this the expected behaviour?
If not, what am I doing wrong?

Apparently one of your modifications to .bashrc introduced an error that treats /bin like something other than a directory (for example, by trying to run it as an executable file, read data from or write data to it as a file, etc.). Because .bashrc runs when your interactive shell starts, the error message always appears.

You may be able to identify the error yourself by looking through your modifications to .bashrc.

(Otherwise, to identify the specific problem it will be necessary to see the contents of your .bashrc file. You can copy its entire contents to the clipboard and paste it into your question, select it in your question, and format it as code with Ctrl+K. If you’ve made this file, much, much longer than it usually is, it might be too long to put into your question in its entirety. In that case, you can post it at http://paste.ubuntu.com and edit your question to include a link to the posting.)

One possibility is that you may have introduced a space in a path starting with /bin. For example, near the beginning of the default .bashrc file is the code:

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

If you accidentally put a space after /bin (in SHELL=/bin/sh), this might produce such an error.

That is just one example, and not necessarily the most likely one.

When I follow the steps for starting a new Cordova PhoneGap project for Eclipse (following these directions: http://docs.phonegap.com/en/2.2.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android ), I drag Android’s /bin directory to the Terminal window first (which contains the create script), then type in:

./create /Users/Steve/Documents/PhoneGap_apps/PhoneGap_apps/appName2 com.companyname.appName2 appName2 

to create the project.

But what I get in return is:

-bash: /Users/Steve/Downloads/phonegap-phonegap-8a3aa47/lib/android/bin: is a directory 

The appName2 directory is not created.

Why do I get that «is a directory» notice, and how do I resolve it to create the directory?

Cœur's user avatar

Cœur

36.9k25 gold badges193 silver badges262 bronze badges

asked Dec 17, 2012 at 20:05

Steve's user avatar

3

Edit: Fixed path.

I think you’re missing a tilde (~) in your path.

Try this:

./create ~/Documents/PhoneGap_apps/PhoneGap_apps/appName2 com.companyname.appName2 appName2 

answered Dec 17, 2012 at 20:11

OakNinja's user avatar

OakNinjaOakNinja

2,32617 silver badges20 bronze badges

9

I successfully created the folder based on Marcus’ response by adding the «cd» first, then adding the entire script. Earlier, attempting his answer, I had first hit Return after dragging the /bin folder over, then adding the script. Doing all three components on a single line did the job.

answered Dec 17, 2012 at 22:07

Steve's user avatar

SteveSteve

1,22919 silver badges40 bronze badges

Этот вопрос уже имеет ответ здесь: что такое каталог с двойной косой чертой (//)? 1 ответ

Иногда, когда я делаю опечатку в терминале и случайно говорю Bash интерпретировать /, я получаю вывод bash: /: Is a directory. Теперь я считаю, что этот вывод должен иметь дело с корневым каталогом или чем-то подобным.

Но я не понимаю, что, когда я ввожу увеличивающиеся количества спреев, он продолжает выводить одно и то же …

Примеры

//// -> bash: ////: Is a directory

//////// -> bash: ////////: Is a directory

задан
6 January 2018 в 09:28

поделиться

3 ответа

/ является разделителем каталогов. Любая строка, которая заканчивается на нем, по определению является именем каталога:

example #This could be a file or directory
example/ #This is a directory in the current directory
/example/ #This is a directory in the root directory

Таким образом, серия из / s будет интерпретирована как серия {null} каталогов. [ ! d2]

ответ дан ravery
22 May 2018 в 15:43

поделиться

/ является разделителем каталогов. Любая строка, которая заканчивается на нем, по определению является именем каталога:

example #This could be a file or directory
example/ #This is a directory in the current directory
/example/ #This is a directory in the root directory

Таким образом, серия из / s будет интерпретирована как серия {null} каталогов. [ ! d2]

ответ дан ravery
17 July 2018 в 23:45

поделиться

/ является разделителем каталогов. Любая строка, которая заканчивается на нем, по определению является именем каталога:

example #This could be a file or directory
example/ #This is a directory in the current directory
/example/ #This is a directory in the root directory

Таким образом, серия из / s будет интерпретирована как серия {null} каталогов. [ ! d2]

ответ дан ravery
24 July 2018 в 17:06

поделиться

When i logging with «oracle» user (su — oracle), «-bash: /home/oracle: is a directory» warning appears.
Is an error? This warning was not happening on my other virtual machine.

asked Aug 20, 2020 at 11:58

zayit's user avatar

Looks like something is trying to execute the string «/home/oracle» as a bash command.

If this happens at each login, it’s possible such a command has been added to .bashrc or .bash_profile, e.g.

# mkdir /home/oracle

# echo '/home/oracle' >> /home/myuser/.bashrc

# su - myuser
Last login: Thu Aug 20 20:44:19 CEST 2020 on pts/0
-bash: /home/oracle: Is a directory

answered Aug 20, 2020 at 18:48

Marco Baldelli's user avatar

Marco BaldelliMarco Baldelli

3,6031 gold badge22 silver badges29 bronze badges

3

Возможно, вам также будет интересно:

  • Bash убрать вывод ошибок
  • Bash скрипты обработка ошибок
  • Bash скрипт прервать если ошибка
  • Bash синтаксическая ошибка ожидается операнд неверный маркер
  • Bash перенаправление потока ошибок

  • Понравилась статья? Поделить с друзьями:
    0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии