Sponsored Content
Full Discussion: Simple unit script
Top Forums UNIX for Dummies Questions & Answers Simple unit script Post 302891065 by Scrutinizer on Monday 3rd of March 2014 03:27:36 PM
Old 03-03-2014
After checking the number of parameters. One way is with a here document:
Code:
for file in "$@"
do
cat << EOF
------------------------------------------
$file
------------------------------------------
$(cat "$file")
------------------------------------------
EOF
done

or

Code:
for file in "$@"
do
  printf "%s\n" "------------------------------------------"
  printf "%s\n" "$file"
  printf "%s\n" "------------------------------------------"
  cat "$file"
  printf "%s\n" "------------------------------------------"
done

--
@in2nix4life : that code will work with any POSIX shell, not just bash...
 

9 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

AIX and DS4300 Storage Unit

Hello, We're setting up a solution for a group of customers with 2 p520 servers and 1 DS4300 unit with 9 disks (at this stage). The meaning is to create two arrays on the DS4300. Both servers will be connected to the DS4300 unit and to both controllers (e.g. Controller 1 connected to server 1... (0 Replies)
Discussion started by: EricBE
0 Replies

2. Shell Programming and Scripting

Getting MAC from GPS unit

Never mind i got the answer thanks., (0 Replies)
Discussion started by: deaconf19
0 Replies

3. Shell Programming and Scripting

Handling Unit Seperator Delimeter

Hi, We have a file with a unit seperator as the delimeter. Here are the Sample lines from the file: ASIA/PACIFICHong KongFX2007071080900 ASIA/PACIFICHong KongFX2007071080900/ 800129HK This delimeter has the ascii value of \037. I have to... (4 Replies)
Discussion started by: sviswana
4 Replies

4. Shell Programming and Scripting

Migration unit testing process

Hi, We are doing migration from DB2 to Teradata. There are couple of things involving in the project. Please see below following order Autosys-Jil script Profile script Category1 Teradata script Data stage job script Tera data script Export files script.. Like that we have 10000... (1 Reply)
Discussion started by: onesuri
1 Replies

5. UNIX for Advanced & Expert Users

Help with connecting 3 or 4 computers to one stereo unit

Nowadays I run Mandriva, Ubuntu and Fedora Core. All of the operating systems works fine on my computers. GRUB gives me the opportunity to select an operating system. I have Windows too. I don't run Windows. I like UNIX. Today I work with 3 computers with a single monitor. This is possible... (4 Replies)
Discussion started by: Angelo
4 Replies

6. Shell Programming and Scripting

Set of 2 records as one unit

Hi Experts, back at this forum again. Have a tab separated file like this --- ACCNN AMT(E/$) TYPE ID 11233 23.20($) AUTH 339 11233 19.00($) FINAL 339 11234 349.84($) AUTH 42332 11234 ... (12 Replies)
Discussion started by: PG3
12 Replies

7. HP-UX

Load average unit

Hi, On load average graph, unit is 100m, 200m, 300...800m. I don't understand what it means. Thx for helping (3 Replies)
Discussion started by: Michenux
3 Replies

8. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

Hello all! This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician. Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix: ... (16 Replies)
Discussion started by: torchij
16 Replies

9. UNIX for Dummies Questions & Answers

Count special symbols between each unit

Can anybody help me figure this out? Thank you in advance. I have a input file. It shows like this: Query= random content random content > random content random content > random content > random content Query= random content random content random content > random content > random... (1 Reply)
Discussion started by: yuejian
1 Replies
SHUNIT2(1)																SHUNIT2(1)

NAME
shunit2 - A unit test framework for shell scripts SYNOPSIS
shunit2 unitfile DESCRIPTION
shUnit2 is a xUnit unit test framework for Bourne based shell scripts, and it is designed to work in a similar manner to JUnit, PyUnit, etc.. If you have ever had the desire to write a unit test for a shell script, shUnit2 can do the job. You can either run shunit2 directly from the commandline and specify the unit file or directly source the shunit2 executable. If you directly execute shunit2 and don't specify a unitfile shunit2 assumes a empty testfile and will return without an error message. EXAMPLE
Simple script to test if 1 equals 1 #! /bin/sh testEquality() { assertEquals 1 1 } # load shunit2 . shunit2 Execute shUnit2 unit tests directly from the commandline shunit2 /path/to/unit/file OPTIONS
shunit2 does not support any commandline options at all. You can either source shunit2 to execute your unit tests or directly run shunit2 as a commandline script. SEE ALSO
For more information see http://code.google.com/p/shunit2/ or have a look at the installed documentation in /usr/share/doc/shunit2/ AUTHOR
shunit2 was written by Kate Ward <kate.ward@forestent.com>. This manpage was written by Ulrich Dangel <mru@spamt.net>. 2.1.6 03/25/2012 SHUNIT2(1)
All times are GMT -4. The time now is 11:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy