Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Running same unix script in different shells
How can I port same shell script in to different shells like C Shell, K
Shell and Bourne Shell

Chitta


Report this thread to moderator Post Follow-up to this message
Old Post
c_jena@ureach.com
04-08-05 01:58 PM


Re: Running same unix script in different shells
c_jena@ureach.com writes:

> How can I port same shell script in to different shells like C Shell, K
> Shell and Bourne Shell

Launching your favorite editor, reading the man page of the source and
the target shell, thinking, and editing the script file.

Also, it's possible to write a single source file usable both in csh,
sh, Fortran and C, and perhaps it would be possible to add  more
languages, so  you would not need to "port" the script...


happy.source:
------------------------------------------------------------------------
cat /*dev/null; echo "Happy New Year"\!
cat <<c*/ /*dev/null | cat > /dev/null
c */ () {} /*
c */ main() { cat(); printf("Happy New Year!\n"); } /*
17      format('Happy New Year!')
write (6,17)
stop
end
c*/
------------------------------------------------------------------------


Makefile:
------------------------------------------------------------------------
all: happy-c happy-f happy-sh happy-csh

happy-c:happy.source Makefile
@ cp happy.source happy-c.c
@ gcc -o happy-c happy-c.c
@ echo -n '(C)            '
@ ./happy-c || true

happy-f:happy.source Makefile
@ cp happy.source happy-f.f
@ f77 -o happy-f  happy-f.f 2> /dev/null
@ echo -n '(FORTRAN)      '
@ ./happy-f

happy-sh:happy.source Makefile
@ cp happy.source happy-sh
@ echo -n '(Bourne Shell) '
@ chmod 755 happy-sh
@ sh ./happy-sh

happy-csh:happy.source Makefile
@ cp happy.source happy-csh
@ chmod 755 happy-csh
@ echo -n '(C Shell)      '
@ csh ./happy-csh

clean:
-rm -f *.o *~ happy-csh happy-sh happy-f happy-f.f happy-c happy-c.c
------------------------------------------------------------------------

--
__Pascal Bourguignon__                     http://www.informatimago.com/

In a World without Walls and Fences,
who needs Windows and Gates?

Report this thread to moderator Post Follow-up to this message
Old Post
Pascal Bourguignon
04-08-05 09:00 PM


Re: Running same unix script in different shells
* Pascal Bourguignon <spam@mouse-potato.com>
| happy.source:

kEWl, D00dE.

R'

Report this thread to moderator Post Follow-up to this message
Old Post
Ralf Fassel
04-08-05 09:00 PM


Re: Running same unix script in different shells
c_jena@ureach.com wrote:

> How can I port same shell script in to different shells like C Shell, K
> Shell and Bourne Shell

Since the KornShell was designed to be a compatible replacement
of the Bourne Shell, it's easy to write a script that runs
with both shells. Just limit yourself to the Bourne Shell
constructs, which are understood by both shells.

The C-Shell is something completely different, inventing
a completely independent command language. The Bourne Shell
and C-Shell command sets are disjoint by a large degree.

The following script shows, that it still is possible to
use all together in one script:

http://www.shelldorado.com/scripts/cmds/shtype

Heiner
--
___ _
/ __| |_ _____ _____ _ _     Heiner STEVEN <heiner.steven@nexgo.de>
\__ \  _/ -_) V / -_) ' \    Shell Script Programmers: visit
|___/\__\___|\_/\___|_||_|   http://www.shelldorado.com/

Report this thread to moderator Post Follow-up to this message
Old Post
Heiner Steven
04-19-05 01:58 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Unix Programming archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:08 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.