Sponsored Content
Top Forums Shell Programming and Scripting Bash (Ubuntu server): Syntax error: "|" unexpected in While-loop Post 302556799 by primaxx on Monday 19th of September 2011 02:51:55 PM
Old 09-19-2011
[Solved] Bash (Ubuntu server): Syntax error: "|" unexpected in While-loop

Hello forum,

I hope my problem is easy to solve for someone in here!

My main task is to copy a large amount of imap-accounts from one server to another. There is a tool (Perl) called imapsync which does the job exellent. Unfortunately I'm only able to run it on one account at a time.

After some heavy googling I learned I could make a shell script that, combined with a csv-file, does the job for me. Well, it turns out that was easier said than done. (I am by no means experienced in shell-scripting. -In fact; I have never made any scripts before...)

What I want the script to do:
As long as there is unread information in the csv-file, I want it to copy the imap-account AND create a logfile for that spesific account.

What the script does:
It gives me the error Syntax error: "|" unexpected...

The script looks like this:
Code:
#! /bin/sh
while IFS=';' read  u1 u2 p2
	do 
		imapsync --buffersize 8192000 --nosyncacls --subscribe --syncinternaldates --debug --host1 mail.server.com --user1 "$u1" --authuser1 administrator@server.com --password1 Password --ssl1 --port1 993 --host2 mail.server.net --user2 "$u2" --password2 "$p2"  --authmech2 PLAIN --ssl2 --port2 993; | tee "$u1".log \
	done < userinfo.csv
exit

If anyone can tell me why this doesn't work and how I should solve it I would be very greatful!

Last edited by primaxx; 09-19-2011 at 04:22 PM.. Reason: Solved
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

"syntax error at line 21 :'done' unexpected." error message"

I am trying to run the script bellow but its given me "syntax error at line 20 :'done' unexpected." error message" can someone check to see if the script is ok? and correct me pls. Today is my first day with scripting. Gurus should pls help out #!/bin/ksh # Purpose: Check to see if file... (3 Replies)
Discussion started by: ibroxy
3 Replies

2. Solaris

"syntax error near unexpected token `fi' "

one of my script as follows HOME=/apps/logs mv $HOME/cron.log $HOME/cron.log.`date +%Y-%m-%d` touch $HOME/cron.log fi i am getting error as follows on the last line we are getting ... "syntax error near unexpected token `fi' " please suggest.... (4 Replies)
Discussion started by: GIC1986
4 Replies

3. Shell Programming and Scripting

Syntax error: word unexpected (expecting ")")

I have a very simple script that reads in the contents of a file (_open.txt) into an array "lyrics": #!/bin/sh # read in the text lyrics=( `cat _open.txt` | tr '\n' ' ') exit 0 It gives the following error message: ./lyrics.sh: 1: Syntax error: word unexpected (expecting ")") I have... (9 Replies)
Discussion started by: figaro
9 Replies

4. Shell Programming and Scripting

Syntax error near unexpected token `"Hit <ENTER> to continue:"'

the below code will search attr string inside makefile under the modelno on given path. echo "Enter model no for searching string inside makefile" read inputs2 #find /pools/home_unix/sapte/work/models/model/$inputs2 -name "makefile" | xargs grep "attr" \; #;;I am getting below error.... (7 Replies)
Discussion started by: lathigara
7 Replies

5. Shell Programming and Scripting

Help with error "syntax error: unexpected end of file"

Hi Techies, can anyone please debug the following Script and let me know what is going wrong here. im getting the following error #!/usr/bin/bash # ############################################################################################## # # Variables # #... (2 Replies)
Discussion started by: mahi_mayu069
2 Replies

6. Shell Programming and Scripting

Help with FTP Script which is causing "syntax error: unexpected end of file" Error

Hi All, Please hav a look at the below peice of script and let me know if there are any syntax errors. i found that the below peice of Script is causing issue. when i use SFTP its working fine, but there is a demand to use FTP only. please find below code and explain if anything is wrong... (1 Reply)
Discussion started by: mahi_mayu069
1 Replies

7. Shell Programming and Scripting

Error"syntax error at line 15: `end of file' unexpected"

While i m running below code, it is giving me the error"syntax error at line 15: `end of file' unexpected". Pls let me know what is wrong here..i tried many ways, but no luck dbSID="SWQE" usrname="apps" password="Wrgthrk3" count=0 while do sqlplus $usrname/$password@$dbSID... (5 Replies)
Discussion started by: millan
5 Replies

8. UNIX for Dummies Questions & Answers

"Help with bash script" - "License Server and Patch Updates"

Hi All, I'm completely new to bash scripting and still learning my way through albeit vey slowly. I need to know where to insert my server names', my ip address numbers through out the script alas to no avail. I'm also searching on how to save .sh (bash shell) script properly.... (25 Replies)
Discussion started by: profileuser
25 Replies

9. BSD

Keep getting error "-bash: ./.profile_z2: line 52: syntax error: unexpected end of file"

#!/bin/bash #-------------------------------------------------------- # Setup prompt # Author Zeeshan Mirza # Data: 06-08-2017 #-------------------------------------------------------- if then . ./.profile_custom_pre fi umask 022 set -o vi export EDITOR=vi export VISUAL=vi... (3 Replies)
Discussion started by: getzeeshan
3 Replies

10. Shell Programming and Scripting

Error: "Syntax error; unexpected end of file"

Hello all, I am running a script to generate a report and mail it to an email address. When I am trying to validate whether the file is a 0 kb file, I am getting the below error. Error: "Syntax error; unexpected end of file" Any suggestions please? Code: #!/bin/sh .... (1 Reply)
Discussion started by: Pradeep_Raj
1 Replies
xpaintro(7)							SAORD Documentation						       xpaintro(7)

NAME
XPAIntro - Introduction to the XPA Messaging System SYNOPSIS
A brief introduction to the XPA messaging system, which provides seamless communication between all kinds of Unix event-driven programs, including X programs, Tcl/Tk programs, and Perl programs. DESCRIPTION
The XPA messaging system provides seamless communication between all kinds of Unix programs, including X programs, Tcl/Tk programs, and Perl programs. It also provides an easy way for users to communicate with these XPA-enabled programs by executing XPA client commands in the shell or by utilizing such commands in scripts. Because XPA works both at the programming level and the shell level, it is a powerful tool for unifying any analysis environment: users and programmers have great flexibility in choosing the best level or levels at which to access XPA services, and client access can be extended or modified easily at any time. A program becomes an XPA-enabled server by defining named points of public access through which data and commands can be exchanged with other client programs (and users). Using standard TCP sockets as a transport mechanism, XPA supports both single-point and broadcast mes- saging to and from these servers. It supports direct communication between clients and servers, or indirect communication via an interme- diate message bus emulation program. Host-based access control is implemented, as is as the ability to communicate with XPA servers across a network. XPA implements a layered interface that is designed to be useful both to software developers and to users. The interface consists of a library of XPA client and server routines for use in programs and a suite of high-level user programs built on top of these libraries. Using the XPA library, access points can be added to Tcl/Tk programs, Xt programs, or to Unix programs that use the XPA event loop or any event loop based on select(). Client access subroutines can be added to any Tcl/Tk or Unix program. Client access also is supported at the command line via a suite of high-level programs. The major components of the XPA layered interface are: o A set of XPA server routines, centered on XPANew(), which are used by XPA server programs to tag public access points with string iden- tifiers and to register send and receive callbacks for these access points. o A set of XPA client routines, centered on the XPASet() and XPAGet(), which are used by external client applications to exchange data and commands with an XPA server. o High-level programs, centered on xpaset and xpaget, which allow data and information to be exchanged with XPA server programs from the command line and from scripts. These programs have the command syntax: [data] | xpaset [qualifiers ...] xpaget [qualifiers ...] o An XPA name server program, xpans, through which XPA access point names are registered by servers and distributed to clients. Defining an XPA access point is easy: a server application calls XPANew(), XPACmdNew(), or the experimental XPAInfoNew() routine to create a named public access point. An XPA service can specify "send" and "receive" callback procedures (or an "info" procedure in the case of XPAInfoNew()) to be executed by the program when an external process either sends data or commands to this access point or requests data or information from this access point. Either of the callbacks can be omitted, so that a particular access point can be specified as read-only, read-write, or write-only. Application-specific client data can be associated with these callbacks. Having defined one or more public access points in this way, an XPA server program enters its usual event loop (or uses the standard XPA event loop). Clients communicate with these XPA public access points using programs such as xpaget, xpaset, and xpainfo (at the command line), or rou- tines such as XPAGet(), XPASet(), and XPAInfo() within a program. Both methods require specification of the name of the access point. The xpaget program returns data or other information from an XPA server to its standard output, while the xpaset program sends data or commands from its standard input to an XPA application. The corresponding API routines set/get data to/from memory, returning error messages and other info as needed. If a template is used to specify the access point name (e.g., "ds9*"), then communication will take place with all servers matching that template. Please note that XPA currently is not thread-safe. All XPA calls must be in the same thread. SEE ALSO
See xpa(7) for a list of XPA help pages version 2.1.14 June 7, 2012 xpaintro(7)
All times are GMT -4. The time now is 08:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy