ALT Linux Community general discussions
 help / color / mirror / Atom feed
* [Comm] sed: замена на переменную
@ 2002-11-27  5:39 Прокопьев Евгений
  2002-11-27  6:07 ` Igor Homyakov
  0 siblings, 1 reply; 2+ messages in thread
From: Прокопьев Евгений @ 2002-11-27  5:39 UTC (permalink / raw)
  To: community

Здравствуйте!

Есть скрипт, который принимает 1 параметр из командной строки и пытается 
заменить $DBDIR в файле db_create.sql на значение этого параметра, а 
затем выполнить этот файл:

#!/bin/bash

sed 's/\$DBDIR/'"$1"'/' db_create.sql > ~/tmp/tmp.sql
isql -m -i ~/tmp/tmp.sql

При выполнении скрипта получаем ошибку
sed: -e expression #1, char 12: Unknown option to 's'

Если написать sed 's/\$DBDIR/'`echo $1`'/' /opt/ewsd/sql/db_create.sql > 
~/tmp/tmp.sql, результат аналогичный.

Если написать sed 's/\$DBDIR/'"xxx"'/' /opt/ewsd/sql/db_create.sql > 
~/tmp/tmp.sql, все замечательно.


Как использовать в sed переменные?

--
С уважением, Прокопьев Евгений



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-11-27  6:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-27  5:39 [Comm] sed: замена на переменную Прокопьев Евгений
2002-11-27  6:07 ` Igor Homyakov

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git