Why is /bin/bash being invoked here? #358
Replies: 2 comments 1 reply
-
Hi, can you check (and take a screenshot of) macOS default shell setting, please? And if it's okay to you, can you please attach I suspect there might be a bug that if system default shell is Bash/Dash/Zsh, then the shell is always looked up from However, the plugin does not detect the invokable shell from the shell command's content. The shell is defined in settings, and by default it should be the operating system's default shell. But like I said, I'm suspecting a bug here, so the system default shell's path is probably not determined correctly. A temporary workaroundYou can create a custom shell and define After the bug is fixed in the future, you can then switch back to use the system default shell as a default for all shell commands, or continue using the custom one. |
Beta Was this translation helpful? Give feedback.
-
And for the command itself:
{
"settings_version": "0.20.0",
"debug": false,
"obsidian_command_palette_prefix": "Execute: ",
"preview_variables_in_command_palette": true,
"show_autocomplete_menu": true,
"working_directory": "",
"default_shells": {
"darwin": "/bin/bash"
},
"environment_variable_path_augmentations": {
"darwin": "{{!environment:PATH}}:/opt/local/bin"
},
"error_message_duration": 20,
"notification_message_duration": 10,
"execution_notification_mode": "permanent",
"output_channel_clipboard_also_outputs_to_notification": true,
"output_channel_notification_decorates_output": true,
"enable_events": true,
"approve_modals_by_pressing_enter_key": true,
"command_palette": {
"re_execute_last_shell_command": {
"enabled": true,
"prefix": "Re-execute: "
}
},
"max_visible_lines_in_shell_command_fields": false,
"shell_commands": [
{
"id": "86ont1g6x3",
"platform_specific_commands": {
"default": "/opt/local/bin/bash bin/obsidian-maintenance.sh"
},
"shells": {},
"alias": "Obsidian Maintenance Script",
"icon": "refresh-ccw",
"confirm_execution": false,
"ignore_error_codes": [],
"output_wrappers": {
"stdout": null,
"stderr": null
},
"output_channel_order": "stdout-first",
"events": {},
"command_palette_availability": "enabled",
"preactions": [],
"variable_default_values": {},
"output_handling_mode": "buffered",
"input_contents": {
"stdin": null
},
"output_handlers": {
"stdout": {
"handler": "notification",
"convert_ansi_code": true
},
"stderr": {
"handler": "notification",
"convert_ansi_code": true
}
}
}
],
,
"builtin_variables": {},
"custom_variables": [
{
"id": "xo59yl4rnz",
"name": "label",
"description": "label",
"default_value": null
},
{
"id": "pnwni09k3y",
"name": "path",
"description": "",
"default_value": null
},
{
"id": "mfnkssqti5",
"name": "bgcolor",
"description": "",
"default_value": null
},
{
"id": "rgoesav4q9",
"name": "fgcolor",
"description": "",
"default_value": null
},
{
"id": "sh21zf1fyz",
"name": "tagname",
"description": "A tag, without the `#` prefix.",
"default_value": null
},
{
"id": "byt21nq52l",
"name": "target",
"description": "The name of the file or dir to operate on. ",
"default_value": null
},
{
"id": "rt9lkpbsqn",
"name": "img_size",
"description": "the width of the images after resizing",
"default_value": null
}
],
"custom_shells": [
{
"id": "vann42pimn",
"name": "macports bash",
"description": "",
"binary_path": "/opt/local/bin/bash",
"shell_arguments": [
"-c",
"{{!shell_command_content}}"
],
"host_platform": "darwin",
"host_platform_configurations": {},
"shell_platform": null,
"escaper": "UnixShell",
"path_translator": null,
"shell_command_wrapper": null,
"shell_command_test": null
}
],
"output_wrappers": []
}
Yes, that's what the message "I am bash" told me and that message prompted my post. :-)
I tried this and it works. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hello,
I have a Shell Command which simply runs a shell script. Nothing fancy.
Note that I have explicitly even asked it to run under /opt/local/bin/bash, not /bin/bash.
The first line in the shell script is
#!/opt/local/bin/bash
So you know it should not be using /bin/bash
However, every time I run this macro, I get the following dialog.
I have put an echo statement in my .profile that announces the shell it is using.
Notice the second dialog, which I don't know where it is coming from, complaining essentially that I'm not using /opt/local/bin/bash, so declare -A is not valid.
What I'm gleaning here is that Obsidian Shell Commands always loads my profile using /bin/bash, which is not my login shell as set in MacOS and is not compatible with my .profile. How do I tell Shell Commands to honor my login shell and not use /bin/bash?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions