Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Need Help Writing Script
robbmcmahan
post Sep 10 2003, 01:07 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 19
Joined: 8-August 03
Member No.: 1,230



Hi,

I am a linx newbie and needing to write a simple external command for Linux. What language do I use? perl? If so, i'm not that great with perl ...i'm mostly a PHP, JavaScript, sorta guy. So, i'm hoping someone can help me. All I need to do is to write a script that will look for a string input and then run a command with the string in it. Like this:

The string variable input:
"hello, how are you?"

The scripts output:
echo "string variable"

I know this will be a simple script I just need to know what language I use for shell scripting in linux and hoping someone can show me somthing using the example above so I can see the syntax from this to get me started.

Much thanks

Thanks
Go to the top of the page
 
+Quote Post
Joey
post Sep 10 2003, 02:00 PM
Post #2


LinuxHelp Admin
*******

Group: Admin
Posts: 1,096
Joined: 18-September 02
Member No.: 1



Theres tons of different ways to do this.

Here's one way with perl:

CODE
#!/usr/bin/perl

$text = "Hello World!";

print $text;
Go to the top of the page
 
+Quote Post
hughesjr
post Sep 11 2003, 12:42 PM
Post #3


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 3,433
Joined: 25-July 03
From: Corpus Chrsiti, TX, USA
Member No.: 1,151



You can use your shell as well - there are sh, ksh, csh and zsh shells to name a few. The default shell in Linux is bash ... so scripting in sh or bash can be done with no modifications to any startup files.

http://mirrors.sunsite.dk/ldp/HOWTO/Bash-P...ntro-HOWTO.html

(look at the Using select to make simple menus section....)


--------------------
Johnny Hughes
hughesjr@linuxhelp.net
Enterprise Alternatives: CentOS, WhiteBoxEL
Favorite Workstation Distros (in order): CentOS, Gentoo, Debian Sarge, Ubuntu, Mandrake, FedoraCore, Slackware, SUSE
Favorite Server Distros (in order): CentOS, WhiteBoxEL, Debian Sarge, Slackware, Mandrake, FedoraCore, Gentoo, SUSE
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 13th December 2017 - 02:29 AM