Search Results

Search: Posts Made By: ngabrani
6,524
Posted By ngabrani
Arithmetic with bash
I need to divide the number of white spaces by total number of characters in a file using bash. I am able to get the number of white spaces correctly using:


tr -cd [:space:] < afile | wc -c
...
6,515
Posted By ngabrani
Thanks, adding the current directory to Path did...
Thanks, adding the current directory to Path did the trick.
6,515
Posted By ngabrani
Bash on Fedora error on basic script
I am not able to execute bash script on Fedora. They were running on another environment. This is a sample script:

#!/usr/bin/bash
input="./data/heu/hout1"
i=1
j=0
while IFS= read -r file1
do...
13,893
Posted By ngabrani
Comparison of floating point numbers in bash
I have the following code snippet in bash

if [[ $diff < $minm ]]; then
minm=`echo "$diff" | bc`
fi


It works well for most of the cases. However lets say diff is -0.17 and minm is...
21,113
Posted By ngabrani
Syntax error in subtraction in Bash
I am sharing a code snippet.

for (( i=0; i<=$(( $count -1 )); i++ ))
do

first=${barr2[$i]}
search=${barr1[$i]}
echo $first
echo "loop begins"
for (( j=0; j<=5000; j++ ))
do...
2,780
Posted By ngabrani
Syntax error in code snippet
Hello,
I am attaching a code snippet. Some of the variables are set in earlier code like count, arrays harr1, harr2, barr1 and barr2. The code below gives syntax errors. I am very new to Bash.

...
2,405
Posted By ngabrani
Many thanks for the detailed feedback. It will...
Many thanks for the detailed feedback. It will help me move forward. Is this code fine for reading the file?

exec 10<&0
exec < './data/heu/hout1'
2,405
Posted By ngabrani
Syntax in a simple script
I am in the process of writing a script. A very preliminary version is giving a syntax error. The script is
#!/bin/bash
#file1='./data/heu/hout1'

exec 10<&0
exec < './data/heu/hout1'...
Showing results 1 to 8 of 8

 
All times are GMT -4. The time now is 01:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy