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 09-27-2003, 02:53 PM   #1
MasterKin8T
Member
 
Registered: Jul 2003
Location: Maryland
Distribution: Slackware 9.1
Posts: 56

Rep: Reputation: 15
Writing C++ Shell Scripts


Can anyone point in the direction of where I can find a tutorial or manual on how to write shell scripts using C++. When I search for just regular shell scripting I only get how to code in C.

Thanks
 
Old 09-27-2003, 03:25 PM   #2
Mohsen
Member
 
Registered: Feb 2003
Location: Iran
Distribution: Solaris 10
Posts: 201

Rep: Reputation: 30
Can't you use system("command");?
 
Old 09-27-2003, 03:40 PM   #3
MasterKin8T
Member
 
Registered: Jul 2003
Location: Maryland
Distribution: Slackware 9.1
Posts: 56

Original Poster
Rep: Reputation: 15
Not quite sure what you mean, ill give a simple example of what Im trying to do:

In C++ to print something to the screen you do

cout << "Whatever"\n";

However, when I try typing this for a shell script I get an error. Maybe I'm totally offbase but I thought C++ was an increment to C and that because of this you can accomplish things better.
 
Old 09-27-2003, 03:47 PM   #4
Mohsen
Member
 
Registered: Feb 2003
Location: Iran
Distribution: Solaris 10
Posts: 201

Rep: Reputation: 30
In a shell script you can not use C/C++ functions, there are some functions like printf available there not all C functions.
You should write your code in a shell scripting language (bash , csh, zsh, ..).
About bash take a look at http://www.tldp.org/HOWTO/Adv-Bash-Scr-HOWTO/index.html
 
Old 09-27-2003, 03:54 PM   #5
MasterKin8T
Member
 
Registered: Jul 2003
Location: Maryland
Distribution: Slackware 9.1
Posts: 56

Original Poster
Rep: Reputation: 15
Thats what I was looking for.

Thanks
 
Old 09-29-2003, 11:43 AM   #6
DIYLinux
Member
 
Registered: Jul 2003
Location: NL
Distribution: My own
Posts: 92

Rep: Reputation: 17
You may also want to learn about escape characters. You missed a backslash in your code. Good news: escaping works pretty much the same in C, C++, shell scripts, java,....
 
  


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
Difficulties writing shell scripts lostinsyntax Programming 8 05-02-2005 08:42 AM
Difficulties writing shell scripts lostinsyntax Linux - Newbie 2 05-01-2005 04:48 PM
I'm terrible at writing shell scripts. A little help fetching files? ashibaka Linux - General 6 04-10-2004 01:41 AM
Writing Shell Scripts in Redhat 6.1 KDE Ace Rimmer Linux - Newbie 3 03-30-2004 03:31 PM
writing Linux shell scripts in Windows NightWolf_NZ Linux - Newbie 3 09-10-2003 10:28 PM


All times are GMT -5. The time now is 09:42 PM.

Main Menu
Advertisement
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