Sponsored Content
Top Forums Shell Programming and Scripting Bash: How can a script create a script? Post 302604894 by methyl on Tuesday 6th of March 2012 09:17:42 AM
Old 03-06-2012
Check the << bit of your bash man pages.
If you quote any part of the here document terminator it disables parameter substitution within the here document:
Code:
cat > child.sh << \EOF



The other approach is to escape any Shell special characters:
e.g.
Code:
echo \$PATH

Quite handy if you are embedding Oracle SQL.

Last edited by methyl; 03-06-2012 at 10:24 AM..
This User Gave Thanks to methyl For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

I need to create a script in bash as follows:

List junk subdirectory in multi-column format Echo/Read : Ask for filename Test for existence of junk/filename True: Test for file size: Size=0: Display "filename exists, but size is zero" Size>0: Display a full listing... (3 Replies)
Discussion started by: POPOPO
3 Replies

2. Shell Programming and Scripting

help with a bash script to create a html table

Hi guys as the title says i need a little help i have partisally written a bash script to create a table in html so if i use ./test 3,3 i get the following output for the third arguement in the script i wish to include content that will be replace the A characters in the... (2 Replies)
Discussion started by: dunryc
2 Replies

3. Shell Programming and Scripting

Create mysql database with bash script - confused

Hi, i have the following: db="create database xxx;GRANT ALL PRIVILEGES ON xxx.* TO user@localhost IDENTIFIED BY 'password';FLUSH PRIVILEGES;quit;" mysql -u root -p$mysql_pass -e "$db" I don't understand why this is failing, it works fine when run from cmd but when is run in a bash script,... (1 Reply)
Discussion started by: ktm
1 Replies

4. Shell Programming and Scripting

bash script to create txt files based on timestamp

Hi , please guide me for a bash script that will create a txt files and the name of the txt files will be as of timestamp so that each file name will be different from other and these files will be get created say after every 10 minutes in a folder(/home/p2000/sxs137), please guide me how would... (1 Reply)
Discussion started by: nks342
1 Replies

5. Programming

Creating a bash script that create/open database

Hi. I have two text files(tables) which include some information and I want to make some query codes using them. First of all, I want to create bash script that read this two tables, create/open database and insert data from files into database. #!/bin/bash while read line; do ... (1 Reply)
Discussion started by: rlaxodus
1 Replies

6. Shell Programming and Scripting

Bash script to create rsa key pair

Hello all, I am setting up a cluster of Mac Pro's which need to be able to talk to a master computer, traffic between the nodes and the master needs to take place without a ssh key. I need a script that will create a security key, save it to the default place, enter the password as no password.... (2 Replies)
Discussion started by: sdl27789
2 Replies

7. Programming

CGI Perl script to execute bash script- unable to create folder

Hi I have a bash script which takes parameters sh /tmp/gdg.sh -b BASE-NAME -n 1 -s /source/data -p /dest/data/archive -m ARC gdg.sh will scan the /source/data and will move the contents to /dest/data/archive after passing through some filters. Its working superb from bash I have... (0 Replies)
Discussion started by: rakeshkumar
0 Replies

8. Homework & Coursework Questions

Create a simple bash backup script of a file

This is the problem: Write a script that will make a backup of a file giving it a ‘.bak’ extension & verify that it works. I have tried a number of different scripts that haven't worked and I haven't seen anything really concise and to the point via google. For brevity's sake this is one of the... (4 Replies)
Discussion started by: demet8
4 Replies

9. Shell Programming and Scripting

Create excel file using bash script

i have written one script which generates text file which gives output like. 001.config: CR1.1 COMPILE_PASSED TEST_PASSED 002.config: CR1.1 COMPILE_FAILED TEST_FAILED . . .so on this text file will get filled one by one as its for loop for n number. i... (7 Replies)
Discussion started by: RamMore123
7 Replies

10. Shell Programming and Scripting

How to create an executable bash script for these commands?

I wish to create an executable bash script that will run the following commands as root, that is, using sudo su iptables-save | awk '/^ / { print $1 } /^:+ / { print $1 " ACCEPT" ; } /COMMIT/ { print $0; }' | iptables-restoreMy first attempt at bash... (9 Replies)
Discussion started by: thixeqi
9 Replies
RHN_CHECK(8)							   Red Hat, Inc.						      RHN_CHECK(8)

NAME
rhn_check - Check for and execute queued actions on RHN. SYNOPSIS
rhn_check [options] DESCRIPTION
rhn_check is a client program that connects to Red Hat Network (or a Red Hat Network Satellite) and receives queued actions for this par- ticular system. After receiving the actions, rhn_check will then process them, and return the results to Red Hat Network. OPTIONS
-v, --verbose Increase the debugging output. --proxy=PROXY Specify an http proxy to use. --proxyUser=PROXYUSER Specify a username to use for an authenticated proxy. This option must be used in conjunction with proxyPassword. --proxyPassword=PROXYPASSWORD Specify a password to use for an authenticated proxy. This option must be used in conjunction with proxyUser. --version Show the program's version number and exit. -h, --help Show a help message and exit. FILES
/etc/sysconfig/rhn/systemid The digital server ID for this machine if the system has been registered onto Red Hat Network. This file does not exist otherwise. /etc/sysconfig/rhn/up2date The common configuration file used by RHN client programs. SEE ALSO
rhn_register(8), rhnreg_ks(8), rhnsd(8), rhn-profile-sync(8), rhnplugin(8), up2date(5). AUTHORS
See the AUTHORS file included with this software. This manual page was written by James Bowes <jbowes@redhat.com> BUGS
Report bugs to <http://bugzilla.redhat.com>. COPYRIGHT
Copyright (C) 1999-2010 Red Hat, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. Linux 2010 August 30 RHN_CHECK(8)
All times are GMT -4. The time now is 08:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy