bashrc not found on MacOS Monterey version 12 0

0 votes

I am using MacOS Monterey version 12.0

I checked in root directory, I don't have .bashrc and .bashprofile, but my system is using .zshrc and .zprofile

I am getting error that

./bin/temp.sh: line 3: /Users/xyz/.bashrc: No such file or directory

Code of temp.sh file at line 3 :

#!/usr/bin/env bash

source ~/.bashrc. # This line is causing error

Temporarily, I replaced this line with below and it is working

#!/usr/bin/env zsh

source ~/.zshrc. # This is working fine !!

From searching over few answers and posts, I got to know that Mac systems are transitioning to zsh from bash, because zsh is improved version of bash

Can anyone tell me proper solution of routing .bashrc or .bashprofile commands to fetch internally .zshrc or .zprofile ?

what will be best solution so that same script file can run on both systems having zsh and bash shells?

May 27, 2022 in Linux Administration by Rahul
• 3,380 points
1,727 views

1 answer to this question.

0 votes
Assuming that you believe your content should utilize zsh, you should supplant the primary line which calls your shell, to settle on it decision zsh rather than slam:

#!/usr/receptacle/env zsh
And afterward ensure your content isn't utilizing anything intended for slam, or adjust the content to supplant tit's "bashisms" with the zsh-explicit counterparts.

On the other hand, you could likewise make the document you want to source with the substance you need. The genuine inquiry is the reason is your content attempting to source .bashrc? Which factors/works/anything that does your content need to instate from that point?
answered May 27, 2022 by Korak
• 5,820 points

Related Questions In Linux Administration

0 votes
1 answer
0 votes
0 answers

wget command not found on linux server

I have a linux server (completely new, ...READ MORE

Apr 25, 2022 in Linux Administration by Edureka
• 13,690 points
884 views
+2 votes
1 answer

Not able to install npm on Ubuntu

Try installing npm using aptitude: sudo apt install aptitude sudo ...READ MORE

answered Nov 28, 2018 in Linux Administration by Omkar
• 69,220 points
8,271 views
0 votes
1 answer

Error saying "Failed to start httpd.service: Unit httpd.service not found."

Execute the following steps or make sure ...READ MORE

answered May 14, 2019 in Linux Administration by Kiara
38,023 views
0 votes
1 answer

Installation fails on xenial "Repository does not have a release file"

This bug is missing log files that ...READ MORE

answered May 23, 2019 in Linux Administration by Ishaan
883 views
0 votes
1 answer

127.0.0.1: Could not Determine the server's fully qualified domain name

If you don't have httpd.conf in folder /etc/apache2, you should ...READ MORE

answered Jun 12, 2019 in Linux Administration by Shubham
• 13,490 points
2,043 views
+1 vote
0 answers

Could not start the machine edureka_host_vm because the following physical network interfaces were not found:

Could not start the machine edureka_host_vm because ...READ MORE

Jan 28, 2020 in Linux Administration by Harish
• 130 points
1,134 views
0 votes
1 answer

Volume group "mylv" not found Cannot process volume group mylv

Hi@akhtar, You got this error because your command ...READ MORE

answered Jul 9, 2020 in Linux Administration by MD
• 95,460 points
4,617 views
0 votes
1 answer

bash: telnet: command not found

Indeed you would have to introduce telnet ...READ MORE

answered May 27, 2022 in Linux Administration by Korak
• 5,820 points
1,700 views
0 votes
1 answer

Is there a limit on the number of words in bash command 'for file in words'?

Anyway, you need to print everything except ...READ MORE

answered May 27, 2022 in Linux Administration by Korak
• 5,820 points
655 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP