WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: /root/.profile bash script  (Read 1791 times)

Offline jedd999

  • Newbie
  • *
  • Posts: 3
/root/.profile bash script
« on: October 19, 2011, 03:22:02 PM »
I am running MicroCore on a USB key (booting from DOS Using Grub4DOS).

I want to run a BASH script which will search through all the disks connected to the system for a specific file, and then make that the active directory when the system is started up.

I have written a script which will get output from fdisk -l, parse it (in an array) and then scan each drive for the applicable file. I have some other stuff running in my /root/.profile, and was hoping to add this code.

The problem is, I cant run this script in .profile as the .profile doesnt seem to support BASH.

The way BASH is loaded is that the files are in the "optional" folder, and I have an onboot.lst file which says "bash.tcz" in it.

Any recommendations for how I can get .profile working with BASH, or a better way to accomplish this???

Thanks for the help!

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: /root/.profile bash script
« Reply #1 on: October 19, 2011, 03:43:07 PM »
Run your bash script from your .profile. It doesn't matter that .profile itself runs in ash.
The only barriers that can stop you are the ones you create yourself.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: /root/.profile bash script
« Reply #2 on: October 19, 2011, 03:55:03 PM »
I don't know what you mean by "active directory when the system is started up."
You can call a script from onboot.sync that must complete before any logins.
Are you sure you can't use the default busybox shell (ash)?
If you want to change the default user, you can use the user= bootcode.
You can also look at /home/tc/.profile and /root/.profile.


Offline jedd999

  • Newbie
  • *
  • Posts: 3
Re: /root/.profile bash script
« Reply #3 on: October 19, 2011, 04:01:48 PM »
By "active directory" I mean the pwd when the entire boot process is done... I want pwd to be the file location of the file I am looking for. It could be on any drive or any partition connected to the system.

I will try to run the script from .profile, but will I be able to set pwd from my script?

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: /root/.profile bash script
« Reply #4 on: October 19, 2011, 05:56:07 PM »
pwd only makes sense for a user session.
To chance the 'print working directory' value, you use cd.