redirecionamento ambíguo

0

O erro é:

line 20: $1: ambiguous redirect

qual poderia ser o problema

#! /bin/bash

while read line
do
    string=$line
    array=(${string//,/ })
    fileName=${array[0]}_"final_fitness.out"
    echo $line > vt.txt
    ./a.out vt.txt
    while read line1
    do
       if 'echo ${line1} | grep "#" 1>/dev/null 2>&1'
       then
           echo "";
       else
            echo ${array[0]},$line1 >> full_log
            break;
       fi
    done < $fileName
done < $1
    
por Sita Kondamadugula 27.04.2015 / 09:03

1 resposta

0

Você inicia seu script sem parâmetros ($ 1), por exemplo:

./myscript

Use isto:

./myscript my_parameter

E há vários problemas no seu script:

   1  #! /bin/bash
   2  
   3  while read line
   4  do
   5      string=$line
   6      array=(${string//,/ })
   7      fileName=${array[0]}_"final_fitness.out"
   8      echo $line > vt.txt
               ^––SC2086 Double quote to prevent globbing and word splitting.
   9      ./a.out vt.txt
  10      while read line1
  11      do
  12         if 'echo ${line1} | grep "#" 1>/dev/null 2>&1'
                ^––SC2092 Remove backticks to avoid executing output.
                ^––SC2006 Use $(..) instead of legacy '..'.
                      ^––SC2086 Double quote to prevent globbing and word splitting.
  13         then
  14             echo "";
  15         else
  16              echo ${array[0]},$line1 >> full_log
                       ^––SC2086 Double quote to prevent globbing and word splitting.
                                   ^––SC2086 Double quote to prevent globbing and word splitting.
  17              break;
  18         fi
  19      done < $fileName
                 ^––SC2086 Double quote to prevent globbing and word splitting.
  20  done < $1
             ^––SC2086 Double quote to prevent globbing and word splitting.
    
por A.B. 27.04.2015 / 09:36