Ok, I will admit right up front that this is stupid, and I shouldn't be hung up on this. I have a script that checks the unallocated areas of space, and checks to see if they are empty or not. If they aren't empty, I run xxd to allow for more analysis.
I have commented out the rest of the script for now. The following section checks if they are empty, and either disregards or creates the output file.
No matter what I do, I can not get it to create the output files using the ofname variable. If I do echo $ofname, it shows correctly, but when I put it the xxd command, it's blank. Using echo to echo the xxd command back shows the filename as there.
As I said in the text, I was using echo to echo back the xxd command as it should be ran. This echos back the command just fine, file name and all. When I actually run xxd (not echo'ed), it doesn't have the file name. Usinb bash -xv, it shows the command as being 'xxd -a', with no file name attached at all.
I have tried putting the variable in (), {}, and any other crazy idea I had, and still nothing.
Any chance the output file name has embedded blanks or other special characters that are confusing bash? In other words, what are typical examples of what $ofname translates to?
Any chance the output file name has embedded blanks or other special characters that are confusing bash? In other words, what are typical examples of what $ofname translates to?
I thought of that. But no.
The file names are generated by the script in the form of Unallocated-[start sector]-[end sector].raw, where [] denotes a variable. These files are created as expected.
Full script (keep in mind most of it is commented out) :
I would try making some other intermediate variables, to better follow what is happening and track down where the glitch is.
For example, I might change the following:
to something like (with better name than "var_x":
Why is the xxd command in back-ticks, since results not assigned to anything? Just wondering.
As part of a bash the below line strips off a numerical prefix from directory 1 to search for in directory 2.
for file in /home/cmccabe/Desktop/comparison/missing/*.txt
do
file1=${file##*/} # Strip off directory
getprefix=${file1%%_*.txt}
... (5 Replies)
Hi All,
I have file which have looks like below
abc=${def}
def=${efg}
efg= "this is the actual value"
based on "abc" value I have to call "efg" value , Am using below lines but it is not working
#!/bin/bash
source file.txt
echo $abc
Please wrap all code, files, input &... (5 Replies)
Hi guys,
I have a file "abc.dat" in below format:
FILE_PATH||||$F_PATH
TABLE_LIST||||a|b|c
SYST_NM||||${SRC_SYST}
Now I am trying to read the above file and want to print the value for above dollar variables F_PATH and SRC_SYST. The problem is it's reading the dollar variables as... (5 Replies)
hello,
I have problem with writing/adjusting a shell script.
I searched forum and unfortunately couldn't write scipt based on the information I found.
I never wtire such so it's hard for me and I do need to modify one script immediately.
case looks like:
1. 'file' that needs to be modified... (3 Replies)
Hi all,
Hereby wish to have your advise for below:
Main concept is
I intend to get current directory of my script file.
This script file will be copied to /etc/init.d.
A string in this copy will be replaced with current directory value.
Below is original script file:
... (6 Replies)
Hi,
I am working on one script..I am having files in the below format
file 1 (each line is separated with : delimeter)
SPLASH:SPLASH:SVN
CIB/MCH:MCH:SVN
Now I want from file 1 that most left part of the first line will store in... (6 Replies)
script below sets variable "var". Then sets "var2" (which contains "var" whithin it, see test.config file) from config file.
test.sh
----------------------------
#!/bin/sh
var="varvalue"
while read line
do
var2=${line}
done <./test.config
echo "var value is: $var"
echo... (2 Replies)
Dear all,
I have basic knowledge of Unix script and her I am trying to process variable length and variable format CSV file.
The file length will depend on the numbers of Earnings/Deductions/Direct Deposits.
And
The format will depend on whether it is Earnings/Deductions or Direct Deposits... (2 Replies)
Hi,
Here is the output of lpstat. I would like to read value of Queue which is(abxxxxb1)and status that is DOWN in first line. i dont care what is in second line. any one can help me.thanks
Queue Dev Status Job Files User PP % Blks Cp Rnk
------- ----- ---------... (5 Replies)