LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-09-2005, 10:35 AM   #1
darkRoom
Member
 
Registered: Mar 2004
Location: Valencia, espaņa
Distribution: Slack, Gentoo, Custom
Posts: 162

Rep: Reputation: 30
c++ uses system to give commands to bash


hi
I want to use system (or any method that works to call the following chroot command in bash.

Code:
chroot "$LFS" /tools/bin/env -i \ HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \ /tools/bin/bash --login +h
the 'PS1='\u:\w\$ ' ' gave me lots of problems so i exported it as a variable = $PSNEW

i just cant seem to get the syntax right in c++ to pass the command, i tried plenty of variations and the code below is as correct as i've got . .

Code:
exitStatus = system("chroot \"$LFS\"" 
" /tools/bin/env -i"
" HOME=/root TERM=\"$TERM\" \"$PSNEW\"" 
" PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin"
" /tools/bin/bash --login +h");
any ideas please ?
 
Old 03-09-2005, 02:32 PM   #2
TheLinuxDuck
Member
 
Registered: Sep 2002
Location: Tulsa, OK
Distribution: Slack, baby!
Posts: 349

Rep: Reputation: 33
Whatever your end goal is with this, there has to be a better way than using c++/system.

What, exactly, is your end goal?
 
Old 03-10-2005, 04:27 AM   #3
darkRoom
Member
 
Registered: Mar 2004
Location: Valencia, espaņa
Distribution: Slack, Gentoo, Custom
Posts: 162

Original Poster
Rep: Reputation: 30
The end goal is simply to create an automated build of LFS, i think you're right, c++ isn't really suited for this.

I'm gonna go use make, i think it'll do the job a lot better
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
gnome-terminal fails to give bash prompt wfhoney Red Hat 8 04-21-2004 03:38 PM
Help with BASH Commands rridler Linux - Newbie 3 04-16-2004 04:43 PM
Bash commands PhuckFonix Linux - Newbie 2 03-30-2004 07:13 PM
Bash commands wprescott Linux - Distributions 6 04-27-2002 02:56 PM
Is it possible to give MSDOS commands in Unix script??? gopi_20us Programming 1 02-20-2002 12:48 AM


All times are GMT -5. The time now is 08:54 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration