Head Tail Problem

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:
    view the 7th line of the program xxx.sh

  2. Relevant commands, code, scripts, algorithms:
    head command tail command grep command piping, etc

  3. The attempts at a solution (include all code and scripts):

(head -7 | tail -1 | grep xxx.sh) < ????

  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
    GSW Americus, Ga, USA Baev, Csci 3200 Georgia Southwestern State University

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

Sidenote: The program has executable permission and it's output is a series of hexadecimal digits when it runs, but when I use head and tail commands to view the lines I get a bunch of alien-like symbols.

This should suffice.

head -7 xxx.sh | tail -1

I tried that but I still get a ton of funky looking characters. When I executed the xxx.sh program it gave me a series of hex. numbers which it was suppose to do as detailed by the instructions I'm going by. Then it tells me to view the 7th line of the program which can be extracted by a cooperative use of head and tail command but no matter how I arrange it every attempt to access what's inside this program results in a page full of unknown characters. I just don't get what I'm doing wrong.

can you post the xxx.sh program.

what is there in that program ? is it binary file or ascii text file ?

execute the below command and post the result

 
file xxx.sh

The program is called 18476.sh when I ./184762.sh a 32 digit hex number appears.
typing file 18476.sh results in the prompt showing me the word 'data'.

Please post the contents of 18476.sh. Usually 'file' command run on a shell script would show something similar to 'Bourne-Again shell script text executable'.

What is the output from this command (which will ignore funny characters):

strings 18476.sh
2H6.
nwOr6
;K?;j
j+U/
i-s+4
#,e
@a&)
ZpS?w=/p
jEaew
b6P\
yUhp
kLzQHa
mA6r
+sFF<7
^6kD
@}lZ
=?]2
Gj.=BO
t6z.
y\t0
ggB<3
+1n,
2"y

What do you see if you type;

file 18476.sh

Regards

Dave

If file command says data then you have to accept the fact that it will not be simple ascii text file, just like wtmp or utmp...

I like very much the solution in post #2 , sice the file is "data" you will have to accept the funky characters...
Using strings will quite surely change the number of lines...

Reference post #8. This is clearly not a Shell script (despite the name of the file). It is some sort of binary file apparently containing executable code.

We don't know what sort of computer course you are doing or what sort of computer you have. I wonder if the tutor is expecting you to disassemble the program first. Bit of a surprise that the "file" command described it as "data" when it appears to be a program, and that "strings" found no program library information.
Have you been working with debugging tools?
Have you covered encryption? (Just wondering if it is encrypted somehow).

If you are on a basic Shell course, it could be that you have been given the wrong file!