Click here to Skip to main content
15,914,452 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i tried running this script but it didn't work! i typed ./FindSCT.bash visit.bash where is FindSC.bash is the name of my script and visit.bash is the file i want to get my input from. i tried to type chmod 700 FindSCT i also wrote chmod +x FindSCT.bash and also typed PATH="${PATH}:." but non of these things actually helped. also i made sure that the two files are in the same directory! any help would be very appreciated!
also i tried to add " " around ($1 also $2).. still command not found 

if i do ls i get this :(the two scripts are in the same directory :/
FindSCT.bash   visit.bash
!


What I have tried:

<pre>  <pre>#!/bin/bash
function ssort {
echo sort -rnk2 $1 | sort -rsk3 | uniq -2 | cut -d" " -f3 | wc -l
}
if (( $# == 1 )); then 
echo -rnk2 $1 | sort -rsk3 | uniq -2 | cut -d" " -f3
fi
if (( $# == 2 )); then 
   nn=`ssort $*`
     if (( ${nn} > $2 )); then
     echo -rnk2 $1 | sort -rsk3 | uniq -2 | cut -d" " -f3
  fi 
    echo -rnk2 $1 | sort -rsk3 | uniq -2 | cut -d" " -f3 | head -n{$2}
fi 
Posted
Updated 19-Apr-17 11:41am
v5
Comments
Richard MacCutchan 19-Apr-17 2:57am    
Please show a long listing (ls -l) of the directory where these scripts are stored.
jena_m 19-Apr-17 4:55am    
the two scripts are in the same directory in the main directory
Richard MacCutchan 19-Apr-17 5:34am    
Show the listing.
jena_m 19-Apr-17 5:44am    
-rwx------ 1 jenazz users 400 Apr 19 11:42 FindSCT.bash
drwxr-xr-x 3 jenazz users 4096 Apr 18 19:01 mtm
drwxr-xr-x 4 jenazz users 4096 Apr 18 19:20 MTMEscapy
-rwx------ 1 jenazz users 77 Apr 19 00:18 visit.bash
Richard MacCutchan 19-Apr-17 5:58am    
Are you actually in that directory when you run the command ./FindSCT.bash ? Also, is the error message definitely in response to your call to the script, or is it in response to some command inside the script?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900