ITPub博客

首页 > 数据库 > Oracle > [20260604]建立完善linesize.sql脚本.txt

[20260604]建立完善linesize.sql脚本.txt

原创 Oracle 作者:lfree 时间:2026-06-04 20:44:09 0 删除 编辑

[20260604]建立完善linesize.sql脚本.txt

--//删除原来建立的linesize.sql脚本,使用我写的脚本,更加科学简单。
--//原始链接 http://berxblog.blogspot.com/2009/07/linesizesql.html

$ cat linesize.sql
-- linesize.sql
--
-- mycpid must be defined before - e.g. in logon.sql
--
-- set linesize according to stty
-- handle with care, as stty is not consistent over platform boundaries
--

set termout off

define _linesize_cmd1 = 'echo -n "set linesize " > /tmp/linesize.sql '
-- for solaris:
-- define _linesize_cmd2 = 'stty -a  | awk -F''[ ;]'' ''/columns/ { print $7 }'' >>/tmp/linesize_&mycpid..sql'
-- for linux:
-- define _linesize_cmd2 = 'stty -a  | awk -F''[ ;]'' ''/columns/ { print $9 }'' >>/tmp/linesize.sql'
define _linesize_cmd2 = 'stty size  | cut -d" " -f2  >>/tmp/linesize.sql'

HOST &_linesize_cmd1
HOST &_linesize_cmd2

@ '/tmp/linesize.sql'

undef _linesize_cmd1 _linesize_cmd2

set termout on

--//新版本如下:

$ cat linesize.sql
-- set linesize according to stty size or tput cols
-- host echo set linesize $(stty size | cut -d" " -f2) > /tmp/linesize.sql
host echo set linesize $(tput cols) |tee /tmp/linesize.sql
@ /tmp/linesize.sql

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-3173114/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7969285