Sponsored Content
Top Forums Shell Programming and Scripting question about about Shell programming Post 302180928 by thungmail on Tuesday 1st of April 2008 01:27:37 PM
Old 04-01-2008
question about about Shell programming

Code:
1.if [ "$1" ]
2.then
3.        # save the number of args and first argument in variables.
4.        num_args=$#
5.        id="$1"
6.        echo "$id"
7.        #echo "$1" > crapfile.txt
8.        echo `sed 's/\*/'\*'/g' < crapfile.txt`

Above is a partial code.I would like to ask:
at line 1: what is $1 how it works
at line 4: what is $#
at line 8: what does it try to do.
I am new to shell programming. Can anyone out there explain it to me. Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Question about Shell Programming

First, I'd like to know if being a shell programmer considered a "real" programmer. is it?? also, I do create a lot of shell programs which includes full scripts to create users and maintaining records. ie phone records. now, I hear the programmer has to do some cleaning up after the... (3 Replies)
Discussion started by: IMPORTANT
3 Replies

2. Shell Programming and Scripting

Post Shell programming: Question about source a file and read data from the file

This is shell programming assignment. It needs to create a file called .std_dbrc contains STD_DBROOT=${HOME}/class/2031/Assgn3/STD_DB (which includes all my simple database files) and I am gonna use this .std_dbrc in my script file (read the data from the database files) like this: .... (3 Replies)
Discussion started by: ccwq
3 Replies

3. Shell Programming and Scripting

question about testing in shell programming

I created a file named q2.c in /home/tuan/Desktop/Shell_programming. I coded a script named "test" to check whether the file existed or not. My code : #!/bin/sh submitDir=/home/tuan/Desktop/Shell_programming/submit if then echo "There is no q2.c" else echo "There is q2.c" fi After... (3 Replies)
Discussion started by: thungmail
3 Replies

4. Shell Programming and Scripting

question about testing in shell programming

Hi i would like to write a "script" which takes a directory as an argument and the script will output the content of a file in this directory.Here is my code #!/bin/sh #set an argument to be a specified path $1=/home/tuan/Desktop/Shell_programming/directory #check if an argument is a... (3 Replies)
Discussion started by: thungmail
3 Replies

5. Shell Programming and Scripting

question about testing in shell programming

I have 2 different directories. The first has 2 sub-folders A and B. The second as 2 sub-folders C and D and script named "script".There is a code of "script" to list 2 sub-folders C and D #!/bin/sh for file in * do && echo $file done I would like to ask how can I make a change if I... (2 Replies)
Discussion started by: thungmail
2 Replies

6. Shell Programming and Scripting

question about testing in shell programming(modifications were made)

In folder A i have a file "a' and text file named infile00.I would like to do redirection :a<infile01. There is a code to do this #get a file "a" in /home/A for file in /home/A/* do if $file ] then #printing out if file is an execute file echo $file "is an... (2 Replies)
Discussion started by: thungmail
2 Replies

7. Shell Programming and Scripting

question about testing in shell programming

In folder A i have a file "a' and text file named infile00.I would like to do redirection :a<infile01. There is a code to do this #get a file "a" in /home/A for file in `ls /home/A` do if then #printing out if file is an execute file echo $file "is an execute... (6 Replies)
Discussion started by: thungmail
6 Replies

8. Shell Programming and Scripting

Beginner Shell Programming Question

Hello all, I am currently try to learn the linux operating system as well as some bash programming. I have come across some online course work which has been very helpful, I have been working through some assignments and since I have no teacher to ask I have come to you experts. So the... (6 Replies)
Discussion started by: g2axiom
6 Replies

9. Shell Programming and Scripting

Plz Help Me in This question in Shell Programming

2- Write a bash shell script filestatic. The script should examine the number files in directories given as arguments (parameters) to this script. a. if one argument is given, the script should count and report the number of files in this directory. Only regular files should be counted, not... (1 Reply)
Discussion started by: tahseen_22334
1 Replies

10. Homework & Coursework Questions

Plz Help Me in This question in Shell Programming

2- Write a bash shell script filestatic. The script should examine the number files in directories given as arguments (parameters) to this script. a. if one argument is given, the script should count and report the number of files in this directory. Only regular files should be counted, not... (1 Reply)
Discussion started by: tahseen_22334
1 Replies
XtCreatePopupShell()													      XtCreatePopupShell()

Name
  XtCreatePopupShell - create a popup shell widget.

Synopsis
  Widget XtCreatePopupShell(name, widget_class, parent, args, num_args)
	 String name;
	 WidgetClass widget_class;
	 Widget parent;
	 ArgList args;
	 Cardinal num_args;

Inputs
  name	      Specifies the resource name for the created shell widget.

  widget_class
	      Specifies the widget class pointer for the created shell widget; must be shellClass or any subclass.

  parent      Specifies the parent widget; must be of class Core or any subclass thereof.

  args	      Specifies the argument list to override the resource defaults.

  num_args    Specifies the number of arguments in the argument list.

Returns
  A widget of class widget_class created as a popup child of parent.

Description
  XtCreatePopupShell()	checks	that  widget_class  is a subclass of Shell, and, if it is, creates a widget of that class.  The widget is not
  stored in the children array (maintained by Composite widgets), but rather in the popup_list array (which all widgets have).

  The screen resource for this widget is determined by first scanning args for the XtNscreen resource.	If it  is  not	found,	the  resource
  database  associated	with  the  parent's screen is queried.	If both queries fail, the parent's screen is used.  Once the screen is deter-
  mined, the resource database associated with that screen is used to retrieve all remaining resources for the widget not specified in args.

Usage
  All shell widgets other than those created by XtAppInitialize() and XtAppCreateShell() must be created  with	XtCreatePopupShell().	Popup
  shells can be a child of any widget, not just Composite widgets.  Remember that shell widgets can only have a single child, which will gen-
  erally be the layout widget that arranges whatever grandchildren widgets are to appear in the popup.

  Creating and realizing a popup shell widget is not enough to make it visible.  To make a shell pop up, use XtPopup() or one of  the  prede-
  fined callback procedures or menu actions that call this function.  To make it popdown, call XtPopdown().

  Rather  than	initializing  an ArgList to pass to XtCreatePopupShell(), you can call XtVaCreatePopupShell() which accepts a NULL-terminated
  variable length argument list of resource names and resource values.

See Also
  XtCallbackExclusive(1), XtMenuPopup(1), XtPopdown(1), XtPopup(1), XtVaCreatePopupShell(1).

Xt - Pop Ups														      XtCreatePopupShell()
All times are GMT -4. The time now is 08:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy