由买买提看人间百态

topics

全部话题 - 话题: bash
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
N**********d
发帖数: 9292
1
来自主题: Programming版 - 问一下bash编程
【 以下文字转载自 Linux 讨论区 】
发信人: NeedForSpeed (study~~~~~), 信区: Linux
标 题: 问一下bash编程
发信站: BBS 未名空间站 (Sun Sep 28 13:26:01 2008), 转信
如何从一个文件中读取一行,然后作为一个变量,将这个变量作为执行命令的一部分参数
例如
一个文件asdf里面包含3行
foo
bar
baz
怎么把他们作为一个命令的一部分执行
test -[上面的变量] -[另一个参数]
谢谢了
j*******e
发帖数: 674
2
来自主题: Programming版 - 弱问bash script, 关于IFS问题
请看下面code
1 #!/bin/bash
2
3 IFS=:
4 func()
5 {
6 echo $#
7 }
8
9
10 func a:b:c
11 func "a:b:c"
12 string="a:b:c"
13 func $string
14 func "$string"
15
16 IFS=" "
17 func a b c
输出结果:
1
1
3
1
3
问题是:
为什么输出结果的第1行是“1”而不是“3”?而最后一行输出是"3"?
xiexie
w***g
发帖数: 5958
3
来自主题: Programming版 - bash中怎样进行变量名递归替换?
我有三个datasets, 分别定义三个变量
A_PARAMS=......
B_PARAMS=......
C_PARAMS=......
用户从命令行输入dataset名,从到变量DATASET中
DATASET=$1
然后怎样得到对应dataset的参数,也就是要实现下面的功能
PARAMS=$($DATASET)_PARAMS
显然上面的语法bash不支持,但不知道有没有可能比较容易地实现这样的功能
t****t
发帖数: 6806
4
来自主题: Programming版 - bash中怎样进行变量名递归替换?
随便看看bash的手册, 可以得到
DATASET=$1
DATASET=${DATASET}_PARAMS
PARAMS=${!DATASET}
w***g
发帖数: 5958
5
bash不能进行浮点运算,如果需要的话得重定向到bc. 你这个情况估计可以这么搞:
./test | while true
do
read A
read B
read C
在这里用ABC
done
o******n
发帖数: 511
6
我这个问题超级新手,请大家帮下忙:
有一堆文件,名字从bactNOG00001.sto到bactNOG70000.sto,我要从bactNOG30000.sto
开始,执行一个hmmbuild的命令,原本的bash loop,假设直接开始,是这样的:
for d in easel/bactNOG/*.sto; do hmmbuild --amino --fast $d.profile $d; done
下面我写的这个,从bactNOG00001开始执行hmmbuild,我知道为啥不对,因为计数应该
是在文件名里,但i计数不影响$d的计数:
i=30000
for d in easel/bactNOG/*.sto; do let i+=1; hmmbuild --amino --fast $d.
profile $d; done
那怎么在for loop里给文件名计数呢?谢谢啦!
v*******e
发帖数: 11604
7
楼主,学这个是浪费生命。直接使用python或者perl解决。学一天就上手,做完了你的
bash script还没写好呢。
N*n
发帖数: 456
8
来自主题: Programming版 - 有人用bash吗?
用shell scripting,但没觉得bash ,korn什么的有多大区别。。
t****a
发帖数: 1212
9
来自主题: Programming版 - 有人用bash吗?
我不懂为啥有ruby这个超集了还要bash干啥?
d*****u
发帖数: 17243
10
我现在有个script是把所有的指定文件打包成tar
( cd "${SOURCE_DIR}" && find . -type f -name "${FILE_GLOB}" ) |
tar -C "${SOURCE_DIR}" --remove-files --files-from - -cf "${TARBALL}"
我现在如果想让第1~100个文件是一个tar文件,101~200个是另外一个tar文件。。。
文件名怎么都无所谓
如果只用bash script容易弄吗?
主要不想嵌入其他的code
t**r
发帖数: 3428
11
当c用的,各种c 的写法,就差加上大括号了
当bash用的。我擦,基本一个函数搞定一切 各种magic number, regex.
当fp用的。map filter lambda满天飞。 怎么不去写lisp啊?
当python用的。我擦,是个东西就是创建dict。这开销。。不忍目睹
还有python门槛太低了,程序员质量根本没发保障
发发牢骚
d****i
发帖数: 4809
12
正确的python的用法是:当bash和Perl的替代品用,当然其实不能代替。
c********l
发帖数: 8138
13
为什么“当然其实不能代替”?
我觉得bash/perl能干的事,python基本都能干
w**2
发帖数: 724
14
来自主题: Programming版 - iMAC terminal bash doesn't take .bashrc ?
New to iMAC,
so when i do "ps" in the iMAC terminal, it says "bash".
but in .bashrc i do have "export PATH=....".
when i do "echo $PATH", it doesn't show my new path.
now if i do "source ~/.bashrc", then new path is added.
why .bashrc is not working from boot up ?
thanks !
w*****g
发帖数: 198
15
#!/bin/bash
PREFIX='ESC]0;'
POSTFIX='^G'
/bin/echo -n "$PREFIX $* $POSTFIX"
x***o
发帖数: 2
16
来自主题: Unix版 - How to use file modifiers in bash/sh
In csh/tcsh scripts, I use
set basename = $1:r
to obtain the root name of $1.
What's the equivalent in sh/bash scripts?
Thanks.
s**n
发帖数: 33
17
来自主题: Unix版 - bash programming problem on string
Hi, I want to find out where a string contains another string, for example,
whether "asdfsdxyx1234" contains "xyx1". How can I do that by bash shell
script? I tried expr match and expr index but could not figure it out.
Thanks.
l**p
发帖数: 474
18
来自主题: Unix版 - 怎样在 bash 下search PATH
I am using cygwin under Win2000.
want to add a search path
and I didn't find the .bash file. where is it?
I install the cygwin on D:
however the default ~/ is refer to the C:
any way to change it to other play?
Thanks alot!
GB
发帖数: 256
19
来自主题: Unix版 - 怎么从BASH 换到 CSH
不熟悉UNIX.
在用APPLE的OSX环境.
不知道怎么从bash 转换到 csh.
h******b
发帖数: 52
20
【 以下文字转载自 Programming 讨论区 】
发信人: hulalalb (just do it), 信区: Programming
标 题: Bash 里一个简单诡异的问题
发信站: BBS 未名空间站 (Mon Sep 27 11:45:20 2010, 美东)
...
echo $stasc
echo $evtsc
echo $stasc $evtsc
...
运行结果如下
...
19.7
8.40
8.40
...
为防止老花,特意C+V
何解???抓狂...
拜诸位...
h******b
发帖数: 52
21
【 以下文字转载自 Programming 讨论区 】
发信人: hulalalb (just do it), 信区: Programming
标 题: Bash 里一个简单诡异的问题
发信站: BBS 未名空间站 (Mon Sep 27 11:45:20 2010, 美东)
...
echo $stasc
echo $evtsc
echo $stasc $evtsc
...
运行结果如下
...
19.7
8.40
8.40
...
为防止老花,特意C+V
何解???抓狂...
拜诸位...
n********r
发帖数: 300
22
我也感觉很奇怪。
我刚刚特意试了下,是打印两个的阿。
是不是配置的问题? 或者说
1 #!/bin/bash
2 a=2
3 b='bbb'
4 echo $a $b
5 echo $PATH $LOGNAME
P**l
发帖数: 3722
23
来自主题: Unix版 - Bash里面 <<< 是什么意思
你搜一下bash redirect stdin应该能搜到
t********e
发帖数: 5
24
来自主题: Windows版 - Vista Bashing Again (转载)
【 以下文字转载自 Seattle 讨论区 】
发信人: TigerMoose (虎牧师), 信区: Seattle
标 题: Vista Bashing Again
发信站: BBS 未名空间站 (Sun Oct 21 12:08:43 2007)
the CD burner is not able to calculate space well, if any calculation is
done at all.
i tried to copy a bunch of files over to a formatted CDR and it complained
that 2 more MB is needed. so i removed about 5 MB worth of files from the
files collection and tried it again.
it didn't complain upfront.
after 5 stinking minutes, the bummer came back and said it needs another
s******r
发帖数: 1245
25
来自主题: Biology版 - bash命令
为啥不用excel
windows guy用bash不是吃饱了撑的嘛
s******s
发帖数: 13035
26
来自主题: Biology版 - bash命令
R慢啊,而且大文件伤内存,python/perl/bash巨快
j*********e
发帖数: 811
27
I run a bash-script with command:
for con in 'seq 50 50 300'...
do
replace "count" $ con
compile
run "10" "con_cnt$con"
done
but the result shows, it runs 10 times at 50,100,200,300
by 150 and 250 only 9 times
then I changed a condition, and this time, it runs 10 times at 50,100,150,
300
by 200 and 250 only 8 times
I read the couu_log.txt, and there are several places, that without the sign
why?
g*g
发帖数: 6908
28
来自主题: EE版 - Why bash TI?
没有要bash TI的意思,只是说ti从原来的几个主战场之一转进了。不知道以后analog
竞争更激烈了ti准备如何应对
intel的问题也很明显,mobile市场上明显起步晚了,desktop/laptop市场饱和萎缩,
server上面有潜在威胁,不过arm在server上还不至于马上造成很大威胁吧
倒是qcom,在baseband上的优势,一时没看到哪家近期能给他很大的威胁
同意你说的,大部分半导体市场都不是快速增长的时期了

Analog
develped
in
M******y
发帖数: 736
29
【 以下文字转载自 Military 讨论区 】
发信人: LostInMoney (蛤蟆功第一重), 信区: Military
标 题: Re: 站务凭什么删bash FLG的帖子!
发信站: BBS 未名空间站 (Mon May 19 19:08:20 2008)
spt
站务应该不是轮子吧,否则开始你的帖子也不会放那么久
你的帖子我觉得挺好的,不应该删,就事论事
地震是自然灾害,没有政府什么事情
flg就是在造谣,没有同情心
ps:买买提可能有美国市场的考虑
但是大是大非面前,一定要立场分明,脚踩两只船,不是长久之计
z*******n
发帖数: 1034
30
来自主题: MobileDevelopment版 - OS X bash Update 1.0
OS X bash Update 1.0
http://support.apple.com/downloads/DL1769/en_US/BashUpdateMaver
b******7
发帖数: 8200
31
no need. We don't have to bash loser.
w*******y
发帖数: 60932
32
THOMAS WOODEN - BASH, DASH, ANNIE, CLARABEL AND SODOR DAIRY CARS $28.99
shipped
Use coupon code : sodor1 for 1 Dollar off
Link:
http://shnoop.com//
Amazon price is about $20.00 for each set of 2 cars
Link:
http://www.amazon.com/Thomas-Friends-Wooden-Railway-Clarabel/dp
j*****h
发帖数: 3292
33
中国股市给Bash 的太厉害了,可以开始建仓了?
K********g
发帖数: 9389
34
Bash过的必跌
u********e
发帖数: 4950
35
adam 最近bash 那个股票了?
T****S
发帖数: 344
36
【 以下文字转载自 Stock 讨论区 】
发信人: HQ (U r freed), 信区: Stock
标 题: 这个版不停止bash将毫无任何希望
发信站: BBS 未名空间站 (Thu Jul 2 16:03:07 2009, 美东)
一方面,龌龊心理的人越来越多,这些人臭气相投
另一方面,真的辨明是非的老手大量都已经离开并且转投其他的论坛或者私下的group
剩下的太多的新手,我不知道怎么回事,越来越不辨是非。
说我反指的你好好看清楚了,我五月初宣布牛市号召buy on dip的时候,naz才1760,
那时候一群家伙说什么在顶部,现在看呢?对于整个6月已经是地板了.5月中,月底的两
个dip你买了吗?正常牛市的一个重大特征是dow,spy将会逐渐钝化,那些"大象"们将趋于
稳定.NAZ将会成为市场的热点.君不见,2003-2006,有几个人提过DOW,SPY如何?
最后我要说的是,凭良心说,我可以无愧于心的说,我比那帮苍蝇更热爱这个版面.简单的
说,我对这个版面是有感情的.我旗帜鲜明地针对他们,就是不希望看到这里就这么被毁
了.
我承认,我的努力基本上失败了.顺便说一句,
m******1
发帖数: 19713
37
来自主题: _LGBT_News版 - Hate-Crime Indictments in Gay Bashing
Hate-Crime Indictments in Gay Bashing
By Julie Bolcer
Hate Crime Video x390 (Screen grab) | Advocate.com
Two men have been indicted on hate-crime charges in the brutal attack on a
gay man in Queens, N.Y., last fall.
According to the New York Daily News, Daniel Aleman, 26, and Daniel
Rodriguez, 21, each face up to 25 years in prison in the assault and robbery
of Jack Price, 49, in the College Point neighborhood October 8.
Price, who is recovering, was nearly killed in the attack that occurred whe
t****n
发帖数: 2601
38
俄国批评文章
The Nobel Peace Prize, and an Instrument of Western Power
11.10.2010
Pages: 123By Peter Baofu, Ph.D.
Contrary to the China-bashing coverage by mainstream Western media (which
also controls much of global media), the award of the 2010 Nobel Peace Prize
to Liu Xiaobo, an imprisoned Chinese (convicted of violating state laws),
does not promote world peace and prosperity in the long run, for seven major
reasons as explained below.
(1) The first reason is that, contrary to the China-bashing t... 阅读全帖
o**1
发帖数: 6383
39
☆─────────────────────────────────────☆
aben (hehe) 于 (Sat Oct 16 23:52:21 2010, 美东) 提到:
前两年诺贝尔和平奖,不论是戈尔,还是obama,国际上各大媒体
都有非常明显的争议性。
只有这次刘晓波,国际上各大媒体,不论左右,conservative还是liberal
一边倒的祝贺刘晓波骂TG,貌似从来没有那么一致过。
说老实话,我本来以为以TG这些年存的那么多外汇储备,收买一两
个所谓“国际友人”,一两个有点影响外国媒体骂骂诺贝尔委员会,
应该还是做得到的,但是到现在都一个多礼拜了,只有一个从来没有
听说过的什么“挪威教授”,还有个美国老年愤青在自己blog的博文
里面指责诺贝尔(人家即使指责诺贝,也没有说TG一个好字),TG喉舌
为了增强影响力,仍是造谣给人家戴了个“CNN VP”的头衔,贻笑大方
难怪啊,菌斑EUV等几个著名五毛这个礼拜都发疯了。
☆─────────────────────────────────────☆
mofia (Mofia) 于 (Sat Oct 16 ... 阅读全帖
g**8
发帖数: 4951
40
来自主题: SanFrancisco版 - macOS/Linux 巨大安全漏洞 shellshock
谢谢楼主的贴。这么大的新闻居然没人讨论?
这里是这次事情的wiki,整个事情还在不断更新
http://en.wikipedia.org/w/index.php?title=Shellshock_%28softwar
上班的电脑不算,我自己的电脑自从N年前开始就只用linux了。结果今晚我根据
wiki上给出的命令做了个测试,结果我的这个比较新的某linux distribution也有问题
,当然,目前所有没有patch的linux系统应该全都有问题。。。
我记得很早的时候,unix上default的shell是sh,csh, tcsh这样的shell, bash是后来随
着linux才开始流行起来的,现在需要看看这次这个bash的漏洞,那个env variable使
用上的漏洞,是从bash最初版本就有的,还是随着linux从linux的open source阵营带
进来的,什么时候带进来的具体check-in,我还没更多阅读,冒昧臆测的话,不知是否
如同上次那个heartbleed,也有可能是人故意埋的bug,上次那个heartbleed是个德国
人某年的新年夜check-in的... 阅读全帖
c*****m
发帖数: 1160
41
Windows client, Ubuntu 12.4 server.
本用户在/etc/passwd里面设置的是 /bin/bash
在server上直接登录,或者在Windows client上用no machine登录,然后打开
terminal,都很正常,用到bash,而且在 .bashrc里面的设置都能应用(提示符是有颜
色的,且显示时间)。
在Windows client用putty登录,发现它没有执行 .bashrc里面的设置。(提示符没有
颜色)。这时候执行
$echo $SHELL
得到的还是 /bin/bash
如果我执行一下
/bin/bash
那么 .bashrc里面的设置正式跑起来了(提示符有颜色);这时候再 $echo $SHELL,
还是相同的 /bin/bash (这时候还是在putty remote connection中)
所以现在的问题是: 用 putty初登录时是什么shell?如果确实是bash,为什么没有执
行.bashrc,而要跑 /bin/bash 之后才执行?
d****t
发帖数: 372
42
来自主题: Living版 - 父母领美国福利
这个教授本人是个jew, 却是个反华先锋! 大家应该反击它才对!
http://www.arthurhu.com/index/matloff.htm
Norman Matloff, The Hatchet Man of Asian Immigration
(Arthur Hu's Norm Matloff fan site) | New additions
Arthur Hu's Norman Matloff page
http://www.arthurhu.com/index/matloff.htm
2 Quick Intros to Matloff / Immigration Issues
Asian Focus April 1998: The Chinese Must Go! Matloff's Myth of a Programmer
Shortage
George Nichol's Other Matloff Fan Site (easier to navigate than this one!)
Where Matloff's been Published
How to C... 阅读全帖
H****l
发帖数: 778
43
来自主题: Apple版 - security update for shellshock
OS X bash Update 1.0 may be obtained from the following webpages:
http://support.apple.com/kb/DL1767 – OS X Lion
http://support.apple.com/kb/DL1768 – OS X Mountain Lion
http://support.apple.com/kb/DL1769 – OS X Mavericks
To check that bash has been updated:
* Open Terminal
* Execute this command:
bash --version
* The version after applying this update will be:
OS X Mavericks: GNU bash, version 3.2.53(1)-release (x86_64-apple-darwin13)
OS X Mountain Lion: GNU bash, version 3.2.53(1)-release (x86_... 阅读全帖
t***s
发帖数: 48
44
俺99年注册的ID两年多不用不好使了。临时搞了个马甲上来。大佬轻拍。
前两天手痒,改dockstar,按这个tutorial:http://www.rudiswiki.de/wiki/DockStarOverview
backup肯定是有了。在一个80G的usb硬盘上。
到了这一步:
-bash-3.2# killall hbwd # stop the Pogoplug software
-bash-3.2# mount -o remount,rw / # make flash ROM writeable, last part
reads "rw SPACE slash"
-bash-3.2# chmod go+w /dev/null # fix a bug
-bash-3.2# vi /etc/init.d/rcS # edit start script
-bash-3.2# mount -o remount,ro / # make flash readonly, last part reads "ro
SPACE slash"
-bash-3.2... 阅读全帖
b******1
发帖数: 466
45
来自主题: Linux版 - 居然没有人讨论shell shock
the script for de-supported version.
I have tested, it's good.
mkdir src
cd src
wget http://ftp.gnu.org/gnu/bash/bash-4.3.tar.gz
#download all patches
for i in $(seq -f "%03g" 1 27); do wget http://ftp.gnu.org/gnu/bash/bash-4.3-patches/bash43-$i; done
tar zxvf bash-4.3.tar.gz
cd bash-4.3
#apply all patches
for i in $(seq -f "%03g" 1 27);do patch -p0 < ../bash43-$i; done
#build and install
./configure --prefix=/ && make && make install
cd ..
cd ..
rm -r src
c*****g
发帖数: 21627
46
来自主题: USANews版 - 疣太高盛迫害前员工
Michael Lewis: Did Goldman Sachs Overstep in Criminally Charging Its Ex-
Programmer?
A month after ace programmer Sergey Aleynikov left Goldman Sachs, he was
arrested. Exactly what he’d done neither the F.B.I., which interrogated him
, nor the jury, which convicted him a year later, seemed to understand. But
Goldman had accused him of stealing computer code, and the 41-year-old
father of three was sentenced to eight years in federal prison.
Investigating Aleynikov’s case, Michael Lewis holds a s... 阅读全帖
o**********e
发帖数: 18403
47
每一个华裔,不管是码工还是大妈,
都应该去toastmasterclub, 需要完善一个面对
BOB B这种言论的effective comeback,
就像找工作需要elevator pitch一样。温和的,
幽默的,甚至简单的就是"what do you mean?"
让他继续rant,然后抓他的篓子。
不要脸红脖子粗,
不要自己缩在小窝里,跟自己的
文化传统玩切割,那是饮鸩止渴。
要团结,温和,勇敢的捍卫
自己文化传统和名誉。
中国和华裔被美国媒体无端妖魔化丑化,
这是华裔必须正视和解决的挑战。
这里有我的version:
http://twodeeprivers.blogspot.com/2014/07/a-toymaking-chinaman-
和一些可以用的标语要是你们想游行:
http://www.mitbbs.com/article_t0/SanFrancisco/34218749.html
----------------------------------要不要slogan? 欢迎加!欢迎转!
Declaration of Independence Written... 阅读全帖
n***y
发帖数: 69
48
来自主题: JobHunting版 - 问个事,这样的面试题难么?
一个数组 [a,b,c,d,d]
找出哪个重复的,用python或者shell
一位国人来面试,说是有5年以上linux admin经验,我们招python的,但是他突然和我
说他python不会,我当时就蒙了,就问他你primary language是什么,他说是bash,那
我说你就用bash来解吧,然后他写了十几行C和bash的混合体。
不知道他怎么搞到我邮箱,现在威胁我说我出题太难了,装逼故意刁难国人.要曝光我。
我想问问大家这题在bash是不是太难了?因为我也不太会bash scripting但是好像是可
以通过简单命令找出重复的值得。
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)