10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
I'm trying to create a shell script that takes a awk script that I wrote and a filename as an argument. I was able to get that done but I'm having trouble figuring out how to keep the header of the output at the top but sort the rest of the rows alphabetically. This is what I have now but it is... (1 Reply)
Discussion started by: Eric7giants
1 Replies
2. Shell Programming and Scripting
Hi All,
I have a script which intends to create as many variables at runtime, as the number of parameters passed to it. The script needs to save these parameter values in the variables created and print them
abc.sh
----------
export Numbr_Parms=$#
export a=1
while
do
export... (3 Replies)
Discussion started by: dev.devil.1983
3 Replies
3. UNIX for Dummies Questions & Answers
I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist.
diff=$1$2.diff
id=$2 new=new_$diff
echo "My id is $1"
echo "I want to sync for user account $id"
##awk command I am using is as below
cat $diff |... (1 Reply)
Discussion started by: Sarita Behera
1 Replies
4. Shell Programming and Scripting
I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist.
diff=$1$2.diff
id=$2 new=new_$diff
echo "My id is $1"
echo "I want to sync for user account $id"
##awk command I am using is as below
cat $diff | awk... (2 Replies)
Discussion started by: Ashunayak
2 Replies
5. Post Here to Contact Site Administrators and Moderators
Variable I have in my shell script
diff=$1$2.diff
id=$2
new=new_$diff
echo "My id is $1"
echo "I want to sync for user account $id"
##awk command I am using is as below
cat $diff | awk -F'~' ''$2 == "$id"' {print $0}' > $new
I could see value of $id is not passing to the awk... (0 Replies)
Discussion started by: Ashunayak
0 Replies
6. Shell Programming and Scripting
I am getting the following error while passing parameter to a shell script called within awk script. Any idea what's causing this issue and how to ix it ? Thanks
sh: -c: line 0: syntax error near unexpected token `newline'
sh: -c: line 0: `./billdatecalc.sh ... (10 Replies)
Discussion started by: Sudhakar333
10 Replies
7. Shell Programming and Scripting
hi everyone
i am trying to do this
bash> cat abc.sh
deepak()
{
echo Deepak
}
deepak
bash>./abc.sh
Deepak
so it is giving me write simply i created a func and it worked
now i modified it like this way
bash> cat abc.sh (2 Replies)
Discussion started by: aishsimplesweet
2 Replies
8. Shell Programming and Scripting
Hello,
I have this awk script that I want to execute by passing parameters through a shell script.
I'm a little confused. This awk script removes duplicates from an input file.
Ok, so I have a .sh file called rem_dups.sh
#!/usr/bin/sh... (4 Replies)
Discussion started by: script_op2a
4 Replies
9. Shell Programming and Scripting
Dear Unix and Linux users,
Good evening to all.
I'm new to this community and thank you for having an wonderful forum.
Dear members i had to create almost some 300 shell script files for a particular task.
I tried something like this....
#!usr/bin/sh
fname=epdb_jobs
for x in `cat $fname`... (3 Replies)
Discussion started by: NehaB
3 Replies
10. Shell Programming and Scripting
Hi,
I have a requirement as below which needs to be done viz UNIX shell script
(1) I have to connect to an Oracle database
(2) Exexute "SELECT field_status from table 1" query on one of the tables.
(3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Discussion started by: balaeswari
6 Replies
SCRIPT(1) BSD General Commands Manual SCRIPT(1)
NAME
script -- make typescript of terminal session
SYNOPSIS
script [-adfkpqr] [-F pipe] [-t time] [file [command ...]]
DESCRIPTION
The script utility makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an
interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1).
If the argument file is given, script saves all dialogue in file. If no file name is given, the typescript is saved in the file typescript.
If the argument command is given, script will run the specified command with an optional argument vector instead of an interactive shell.
The following options are available:
-a Append the output to file or typescript, retaining the prior contents.
-d When playing back a session with the -p flag, do not sleep between records when playing back a timestamped session.
-F pipe
Immediately flush output after each write. This will allow a user to create a named pipe using mkfifo(1) and another user may watch
the live session using a utility like cat(1).
-f Create file.filemon or typescript.filemon using filemon(4).
-k Log keys sent to the program as well as output.
-p Play back a session recorded with the -r flag in real time.
-q Run in quiet mode, omit the start, stop and command status messages.
-r Record a session with input, output, and timestamping.
-t time
Specify the interval at which the script output file will be flushed to disk, in seconds. A value of 0 causes script to flush after
every character I/O event. The default interval is 30 seconds.
The script ends when the forked shell (or command) exits (a control-D to exit the Bourne shell (sh(1)), and exit, logout or control-D (if
ignoreeof is not set) for the C-shell, csh(1)).
Certain interactive commands, such as vi(1), create garbage in the typescript file. The script utility works best with commands that do not
manipulate the screen. The results are meant to emulate a hardcopy terminal, not an addressable one.
ENVIRONMENT
The following environment variables are utilized by script:
SCRIPT
The SCRIPT environment variable is added to the sub-shell. If SCRIPT already existed in the users environment, its value is overwrit-
ten within the sub-shell. The value of SCRIPT is the name of the typescript file.
SHELL If the variable SHELL exists, the shell forked by script will be that shell. If SHELL is not set, the Bourne shell is assumed. (Most
shells set this variable automatically).
SEE ALSO
csh(1), filemon(4) (for the history mechanism).
HISTORY
The script command appeared in 3.0BSD.
The -d, -p and -r options first appeared in NetBSD 2.0 and were ported to FreeBSD 9.2.
BUGS
The script utility places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects.
It is not possible to specify a command without also naming the script file because of argument parsing compatibility issues.
When running in -k mode, echo cancelling is far from ideal. The slave terminal mode is checked for ECHO mode to check when to avoid manual
echo logging. This does not work when the terminal is in a raw mode where the program being run is doing manual echo.
If script reads zero bytes from the terminal, it switches to a mode when it only attempts to read once a second until there is data to read.
This prevents script from spinning on zero-byte reads, but might cause a 1-second delay in processing of user input.
BSD
December 4, 2013 BSD