Solved

ksh with a.... #include

Posted on 2006-11-14
7
1,457 Views
Last Modified: 2013-12-20
Came across a ksh script that has these two lines right near the top.

#include <string.h>
#include <stdio.h>

Is there any reason why these should be there,  or are they just
artifacts from a previous c time?

Thanks

0
Comment
Question by:hank1
7 Comments
 
LVL 11

Expert Comment

by:cjjclifford
ID: 17939280
In KSH these are just being seen as comments (the "#" is a comment-delimiter).

If this is truely a KSH script then these are meaningless... However, are you sure this is indeed a KSH script?
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 125 total points
ID: 17939753
Those 2 lines are what u typically include in a C program, u do not add anything like that in a shell script.
so your suspicions are correct, its artifacts from a previous C time.

Does this script of yours contain anything like

main()

or

printf

or some other C type calls?
Does it contain any comments that start with

/*

or

//

0
 
LVL 48

Expert Comment

by:Tintin
ID: 17941770
How did you determine it was a ksh script?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 11

Expert Comment

by:cjjclifford
ID: 17945445
If you're on a Unix system, what is the output of "file scriptname" (assuming "scriptname" is the name of the file in question). What Unix are you on (if Unix that is...)
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17960316
> Is there any reason why these should be there,  or are they just artifacts from a previous c time?
if it is really a ksh script (meaning korn shell script), possible answers are:
  yes (if your meant "why are they there", ask the author)
  no   (if you meant if they are executed by ksh)
0
 
LVL 1

Author Comment

by:hank1
ID: 17986718
tintin - named 'sdfsdfs.ksh' in a bin directory full of them.  I suppose it could have been another shell.
ahoffmann - author long gone.
cjjclifford  - file output = shell script  - ksh (Korn shell)
Thanks all.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17987952
does this mean that your file actually was C code and not ksh script
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sameEnds challenge 3 107
method notes when mouse over in eclipse 5 68
fix34  challenge 9 97
Using YubiKey with REST API application 2 82
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now