Skip to content
Advertisement

Tag: sh

How to write shell script,to automate file conversion?

I have 30 files(ascii),which I want convert to binary.Linux command line(FORTRAN 77 CODE) that has been compiled Relevant part of the code Then code asks for input and output file names How to automate this?I have tried like this Or But I do not have a clue for next step.Text files are Output files Answer Try this: The variable op_file

Are linux shell pipes pipelined?

Given a file input.txt if I do something like is the output from the first command continuously passed (as soon as it is generated) as input to the second command? Or does the pipe wait until the first command finishes to start running the second command? Answer Yes, they’re pipelined — each component’s stdout is connected to the stdin of

Can I use hexdump in a shell script?

Can I use hexdump in a shell script? When I use it I keep getting an error . syntax error near unexpected token ‘hexdump’ I am not able to figure out why the hexdump code is giving me an error . Please help . Answer You are missing the do in your for loop:

cronjob does not execute a script that works fine standalone

I have my php script file in /var/www/html/dbsync/index.php. When cd /var/www/html/dbsync/ and run php index.php it works perfectly. I want to call PHP file through sh file, the location of SH file is as below This is the content of the dbsync.sh file is: When I cd /var/www/html/dbsync/ and run ./dbsync.sh it works perfectly as well. Now if I set

Undersired echo truncate in sh Linux

I want to send two variables as input to another command in shell script. I have tried many methods to send the two variables but I am getting unexpected problems with echo command. the above string gives unexpected truncated output.i am getting the Variables after reading from a file.(ex : HOURS1=cat time_now |cut -d ‘.’ -f 1 ) I have

check if a file is jpeg format using shell script

I know I can use file pic.jpg to get the file type, but how do I write an if statement to check it in a shell script? E.g. (pseudo code): Answer Try (assumes Bash v3.0+, using =~, the regex-matching operator): If you want to match file’s output more closely: This will only match if the output starts with ‘JPEG’, followed

Dynamically-created ‘zip’ command not excluding directories properly

I’m the author of a utilty that makes compressing projects using zip a bit easier, especially when you have to compress regularly, such as for updating projects submitted to an application store (like Chrome’s Web Store). I’m attempting to make quite a few improvements, but have run into an issue, described below. A Quick Overview My utility’s command format is

How to execute sh command set in shell variable?

I have this linux command: candump -l -e -x -s 0 -n 10 any,0~0,#FFFFFFFF 2> /dev/null > /tmp/can.log & It works correctly when I run it directly in shell. I want to add it in my script with this method: When I execute my script I get this error: SIOCGIFINDEX: No such device I have tested these script and it

Advertisement