02-13-2020
Hi Rudi,
On the command line I'd assume something along the lines of head -1 ff* | tr “-“ “/“ to get the dates but not sure how I can then take this forward inside a script after that.
Last edited by pierreDefuncto; 02-13-2020 at 03:50 AM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi guys!
I have just started with shell programming!!
I am having pronblem with variable subsitutuion.
when i do
egrep "*" marks
this will give me the pattern match.
but how can i catch the output of that result in a variable.
if i say
result = egrep "*" marks
it gives me syntax... (2 Replies)
Discussion started by: vmtailor
2 Replies
2. UNIX for Dummies Questions & Answers
Hi Guys,
I am trying to alter a script for my company.
I need the start of it to go something like this.
User is asked to input 8 numbers
8 numbers are written to a txt file
***** ***** ***** txt file is read ***** *****
The text file gets read in between other files represented by... (2 Replies)
Discussion started by: outthere_3
2 Replies
3. Shell Programming and Scripting
Hi all,
i am beginner to unix and trying out a shell script which does the following. i have to calculate a persons salary. his salary is read from the keyboard. he has two types of deductions. 40% as dearness allowance and 20% as house rent. i have to print the gross salary. here is the code... (5 Replies)
Discussion started by: Irishboy24
5 Replies
4. Shell Programming and Scripting
I need to invoke a program on remote server using ssh in a shell script. In addition i would like to capture date/time and if there is any errors , then script should write to log file. can someone please help me out? (1 Reply)
Discussion started by: sam101
1 Replies
5. Shell Programming and Scripting
Hi,
I have a file in which records contains non ascii characters. The records are comma delimited and quoted.
The non ascii characters are found in a particular column.
Example records
"YY","AK000021","Ã","IO","PP"
"Y1","AK000022","Ã","PO","PP"
"Y2","AK000022","Ã","PO","PP"
I need to... (2 Replies)
Discussion started by: akshu.agni
2 Replies
6. Shell Programming and Scripting
HELP!My program ends after entering one choice---need help making it take multiple inputs,instead of terminating after displaying just one
#!/bin/bash# Crude address databaseclear # Clear the screen.echo " Contact List"echo " ------- ----"echo "Choose one of the following... (6 Replies)
Discussion started by: help123
6 Replies
7. Shell Programming and Scripting
hi guys
we've had nagios spewing false alarm (for the umpteenth time) and finally the customer had enough so they're starting to question nagios. we had the check interval increased from 5 minutes to 2 minutes, but that's just temporary solution. I'm thinking of implementing a script on the... (8 Replies)
Discussion started by: hedkandi
8 Replies
8. Shell Programming and Scripting
I need to create digit day script that takes a single numeric argument and then it should print out the day of the week using the number modulo 7 formula e.g: 0 - Sunday 6- Saturday 131 - Friday
I am fairly new to unix so I don't know how to use the number modulo 7 formula.
Does the script need... (3 Replies)
Discussion started by: lukefrost96
3 Replies
9. Shell Programming and Scripting
So I'm trying to pass certain json elements as env vars and use them later on in a script.
Sample json:
JSON='{
"Element1": "file-123456",
"Element2": "Name, of, company written in, a very weird way",
"Element3": "path/to/some/file.txt",
}'
(part of the) script:
for s... (5 Replies)
Discussion started by: da1
5 Replies
10. UNIX for Beginners Questions & Answers
In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed ? Is there any way to get the script names for the process command ?
--- Post updated at 08:39 AM ---
in KSH (Korn Shell), my command output shows the script names but when run in the Bash Shell... (3 Replies)
Discussion started by: i4ismail
3 Replies
LEARN ABOUT XFREE86
script
SCRIPT(1) User Commands SCRIPT(1)
NAME
script - make typescript of terminal session
SYNOPSIS
script [options] [file]
DESCRIPTION
script makes a typescript of everything displayed 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 the dialogue in this file. If no filename is given, the dialogue is saved in the file type-
script.
OPTIONS
-a, --append
Append the output to file or to typescript, retaining the prior contents.
-c, --command command
Run the command rather than an interactive shell. This makes it easy for a script to capture the output of a program that behaves
differently when its stdout is not a tty.
-e, --return
Return the exit code of the child process. Uses the same format as bash termination on signal termination exit code is 128+n.
-f, --flush
Flush output after each write. This is nice for telecooperation: one person does `mkfifo foo; script -f foo', and another can
supervise real-time what is being done using `cat foo'.
--force
Allow the default output destination, i.e. the typescript file, to be a hard or symbolic link. The command will follow a symbolic
link.
-q, --quiet
Be quiet (do not write start and done messages to standard output).
-t[file], --timing[=file]
Output timing data to standard error, or to file when given. This data contains two fields, separated by a space. The first field
indicates how much time elapsed since the previous output. The second field indicates how many characters were output this time.
This information can be used to replay typescripts with realistic typing and output delays.
-V, --version
Display version information and exit.
-h, --help
Display help text and exit.
NOTES
The script ends when the forked shell exits (a control-D for 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. script works best with commands that do not manipulate
the screen, the results are meant to emulate a hardcopy terminal.
It is not recommended to run script in non-interactive shells. The inner shell of script is always interactive, and this could lead to
unexpected results. If you use script in the shell initialization file, you have to avoid entering an infinite loop. You can use for
example the .profile file, which is read by login shells only:
if test -t 0 ; then
script
exit
fi
You should also avoid use of script in command pipes, as script can read more input than you would expect.
ENVIRONMENT
The following environment variable is utilized by script:
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) (for the history mechanism), scriptreplay(1)
HISTORY
The script command appeared in 3.0BSD.
BUGS
script places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects.
script is primarily designed for interactive terminal sessions. When stdin is not a terminal (for example: echo foo | script), then the
session can hang, because the interactive shell within the script session misses EOF and script has no clue when to close the session. See
the NOTES section for more information.
AVAILABILITY
The script command is part of the util-linux package and is available from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils
/util-linux/>.
util-linux June 2014 SCRIPT(1)