Sponsored Content
Top Forums Shell Programming and Scripting Sed, bash problems migrating from Cray to GNU/Linux Post 302887621 by Scrutinizer on Sunday 9th of February 2014 01:33:18 PM
Old 02-09-2014
Hi, the problem is here:
Code:
for i in $@ do

Which should be
Code:
for i in "$@"; do

or
Code:
for i in "$@"
do

Your old shell (on the Cray) may have happened to accept it, but it is not correct.

--
Also note that because of the single quotes, the variables will not be expanded:
Code:
nohup mark i='$i' o='$out' r='$res' v='$vc' >&'$tmp' &

If you need them expanded, use double quotes instead of single quotes...


--
Since "$@" is the default you can also just omit it:
Code:
for i do

or
Code:
for i
do

This:
Code:
for i ; do

is officially not allowed in the Posix specification, but most modern shells do not have a problem with it, unlike earlier Bourne Shells.

Last edited by Scrutinizer; 02-09-2014 at 04:37 PM..
These 3 Users Gave Thanks to Scrutinizer For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

problems with sed and bash. Escaped characters ?

Hi, I'm writing a long script for bash (on RHEL 5.0) to execute many commands. So, my idea is to create a function to deal with error checking and logging (see ceckoutput() below). This works with all commands except for sed. I think it may be a problems with escaped characters. So I did the... (4 Replies)
Discussion started by: macL
4 Replies

2. Ubuntu

Migrating from Unix to Linux

Is there a way to migrate username password from Freebsd 6.1 to Linux Ubuntu 8.04. I am using the server as a email server running postfix and using imap. Is there a way to transfer the usernames and password. I have transferred all the Maildirs but I am getting uid errors and gid errors even after... (2 Replies)
Discussion started by: rbizzell
2 Replies

3. Shell Programming and Scripting

Subtracting time with awk - BASH/Debian GNU Linux

I'm sure this is simple and I've been looking at examples for days on end but can't seem to come to grips with awk. What I have: mplayer -v dvd:// -identify -vo null -ao null -nolirc -nojoystick -frames 0 2>/dev/null >> /tmp/MplayerOut ChapterStart=($(grep CHAPTERS: /tmp/MplayerOut |sed... (3 Replies)
Discussion started by: rickenbacherus
3 Replies

4. Programming

Project ideas for GNU/Linux C and BASH development

Hello everyone... I'm trying to find an interesting project to work on for my master thesis. I like GNU/Linux C development and BASH scripting. Please give me any idea that flashes in your mind. I thank you in advance... (3 Replies)
Discussion started by: jonx
3 Replies

5. HP-UX

Migrating from HP UX to LINUX/SOLARIS- which one is more preferable?

Hi all, We have an application that is running on HP-UX operating system (11i). the application is built using C, C++, ProC and ProC++ codes. we have been given two choices for migration: LINUX and SOLARIS. I would like to know the differences between the three OS and which OS to prefer... (3 Replies)
Discussion started by: pb0069950
3 Replies

6. Linux

Migrating RCS from HP-UX to Linux

Hello all, We would be migrating from HP-UX 11 to Red Hat Linux 5 shortly. On HP-UX we've been using RCS (Revision Control system). On RHEL I think there is an equivilant utility called Subversion..Is there a way to export the current contents from RCS in HP-UX and import it into Linux's... (2 Replies)
Discussion started by: luft
2 Replies

7. AIX

Help migrating bash script to AIX machine

hey frnds I am trying to migrate a bash script over the AIX machine , but was getting error with ps and read commands, so I make the few changes in script and have also chnaged the shell from bash to ksh below is my script... (5 Replies)
Discussion started by: sumit_saxena
5 Replies

8. Shell Programming and Scripting

Converting from Linux bash (GNU) to Solaris script syntax errors

Original script written on CentOS 6.3 with GNU bash 4.1.2 Destination system is Solaris 9 with GNU bash 2.05 (not changeable by me) I have a script written on the linux side but now we need to provide a version to another site that "doesn't like linux". I've been going through changing the ] or... (13 Replies)
Discussion started by: oly_r
13 Replies

9. Shell Programming and Scripting

sed problems - Bash Script

Hi I keep getting the following error sed: -e expression #1, char 32: unterminated `s' command sed: -e expression #1, char 35: unterminated `s' command sed: -e expression #1, char 35: unterminated `s' command whenever I use the following bash script #! /bin/bash... (2 Replies)
Discussion started by: spbr
2 Replies
All times are GMT -4. The time now is 10:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy