Sponsored Content
Full Discussion: stack problem
Top Forums UNIX for Dummies Questions & Answers stack problem Post 18714 by Jimbo on Tuesday 2nd of April 2002 09:53:45 AM
Old 04-02-2002
Quote:
I understand this will return the final character of the $file variable.
Just to be clear, we are talking about returning the first or final character of a file, and does not matter if it is referenced by actual name or the filename is contained in a variable. Returning portions of what is currently held in a variable is very common, but I think not what we want here.

OK, so head -1 myfile gets you the first line. Now pipe that into a command that will cut the first column out. But if the first line is empty, this solution results in null:
Code:
char1=`head -1 myfile | cut -c1`
echo "first character is $char1"

Jimbo
 

7 More Discussions You Might Find Interesting

1. Programming

memory stack problem

Hi, I am writing a C program under SCO Unix. I have a memory stack problem but do not know how to go about fixing it. I have tried running INSURE but that does not detect any problems. Essentially the problem is that the memory address shifts on return from a routine. I pass a pointer to... (3 Replies)
Discussion started by: jkeagy
3 Replies

2. Programming

stack query

can anyone explain how the local variables are acessed from a stack frame of that particular function..since stacks can only push or pop values and stack pointer always points to top of the stack and the frame pointer always points to the end of the previous stack frame..how local variables are... (4 Replies)
Discussion started by: aloksave
4 Replies

3. Programming

what is stack winding and stack unwinding

helo can u tell me what do you mean by stack winding and stack unwinding Regards, Amit (2 Replies)
Discussion started by: amitpansuria
2 Replies

4. HP-UX

Problem with stack overflow

Hi, I get a problem with stack overflow on HP-UX, when running a C program. Pid 28737 received a SIGSEGV for stack growth failure. Possible causes: insufficient memory or swap space, or stack size exceeded maxssiz. The possible cause i found, was that the definition of a structure had... (0 Replies)
Discussion started by: karthikb23
0 Replies

5. UNIX for Dummies Questions & Answers

Kernel Stack vs User Mode Stack

Hi, I am new to the linux kernel development area. I want to know what is the difference between kernel mode stack and user mode stack? Does each process has a user mode stack and a kernel mode stack?? Or Each process has a user mode stack and there is only one kernel mode stack that is shared by... (4 Replies)
Discussion started by: saurabhkoar
4 Replies

6. Shell Programming and Scripting

Stack Trace

Hi All Thought it would be kind of fun to implement a stack trace for a shell script that calls functions within a sub shell. This is for bash under Linux and probably not portable - #! /bin/bash error_exit() { echo "=======================" echo $1 echo... (4 Replies)
Discussion started by: steadyonabix
4 Replies

7. UNIX for Dummies Questions & Answers

What happens to the stack?

Consider this bad code, edited in Windows and run via CygWin after dos2unix so be aware of any hidden "\r" charatcers... #!/bin/bash n=0 stackit() { eval $1 if then exit 0 fi n=$ echo "$n" stackit stackit } stackit stackit Run under CygWin:- AMIGA:~> cd /tmp AMIGA:/tmp>... (2 Replies)
Discussion started by: wisecracker
2 Replies
doctoc_intro(n) 						Documentation tools						   doctoc_intro(n)

__________________________________________________________________________________________________________________________________________________

NAME
doctoc_intro - doctoc introduction DESCRIPTION
doctoc (short for documentation tables of contents) stands for a set of related, yet different, entities which are working together for the easy creation and transformation of tables of contents for documentation. These are [1] A tcl based language for the semantic markup of a table of contents. Markup is represented by Tcl commands. [2] A package providing the ability to read and transform texts written in that markup language. It is important to note that the actual transformation of the input text is delegated to plugins. [3] An API describing the interface between the package above and a plugin. Which of the more detailed documents are relevant to the reader of this introduction depends on their role in the documentation process. [1] A writer of documentation has to understand the markup language itself. A beginner to doctoc should read the more informally written doctoc language introduction first. Having digested this the formal doctoc language syntax specification should become understand- able. A writer experienced with doctoc may only need the doctoc language command reference from time to time to refresh her memory. While a document is written the dtp application can be used to validate it, and after completion it also performs the conversion into the chosen system of visual markup, be it *roff, HTML, plain text, wiki, etc. The simpler dtplite application makes internal use of doctoc when handling directories of documentation, automatically generating a proper table of contents for them. [2] A processor of documentation written in the doctoc markup language has to know which tools are available for use. The main tool is the aforementioned dtp application provided by Tcllib. The simpler dtplite does not expose doctoc to the user. At the bottom level, common to both applications, however sits the package doctoools::toc, providing the basic facilities to read and process files containing text in the doctoc format. [3] At last, but not least, plugin writers have to understand the interaction between the doctools::toc package and its plugins, as described in the doctoc plugin API reference. RELATED FORMATS
doctoc does not stand alone, it has two companion formats. These are called docidx and doctools, and they are for the markup of keyword indices, and general documentation, respectively. They are described in their own sets of documents, starting at the docidx introduction and the doctools introduction, respectively. BUGS, IDEAS, FEEDBACK This document, will undoubtedly contain bugs and other problems. Please report such in the category doctools of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have. SEE ALSO
docidx_intro, doctoc_lang_cmdref, doctoc_lang_faq, doctoc_lang_intro, doctoc_lang_syntax, doctoc_plugin_apiref, doctools::toc, doc- tools_intro KEYWORDS
markup, semantic markup, table of contents, toc CATEGORY
Documentation tools COPYRIGHT
Copyright (c) 2007 Andreas Kupries <andreas_kupries@users.sourceforge.net> doctools 1.0 doctoc_intro(n)

Featured Tech Videos

All times are GMT -4. The time now is 01:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy