Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #bash pada Tuesday, August 26, 2014 09:38 PM
- Mengenai cara mencegah bash history yang selalu terpotong
- =========================================================
- [21:07:35] <Malsasa> I found my bash history always truncated into 500 lines again, after I open mode than 3 bash instance (3 Terminal Emulators concurrently). My .bashrc code for keeping the history is here http://paste.ubuntu.com/8145842/. I have specified histappend, make HISTSIZE big, using history -a -r, etc. but the history still truncated. How to make the bash history eternal, for all bash instance in any number Terminal window opened in one time? I need it, it is so important for me (tracking error, etc). Thanks.
- [21:07:36] <osse> the advantage of my method is that if the number of files is not equal to 55 files you will gzip a number of files unequal to 45, and if there are fewer than 10 files you get thousands of usage texts
- [21:07:57] <Riviera> Malsasa: I believe the FAQ addresses that.
- [21:08:04] <-- Naib (~j@fu/hw/naib) has quit (Quit: Nothing to see here)
- [21:08:07] <osse> !faq history > Malsasa
- [21:08:08] <greybot> Malsasa: http://mywiki.wooledge.org/BashFAQ/051 -- I want history-search just like in tcsh. How can I bind it to the up and down keys?
- [21:08:09] <Malsasa> Riviera: I will see it.
- [21:08:13] <osse> ooops
- [21:08:15] <osse> !faq history > lose
- [21:08:15] <greybot> lose: http://mywiki.wooledge.org/BashFAQ/051 -- I want history-search just like in tcsh. How can I bind it to the up and down keys?
- [21:08:16] <geirha> Malsasa: HISTSIZE wraps at 2^32 iirc
- [21:08:21] --> tandroid (~Adium@50-201-154-94-static.hfc.comcastbusiness.net) has joined #bash
- [21:08:23] <osse> !faq lose > Malsasa
- [21:08:24] <greybot> osse: No matches found at http://mywiki.wooledge.org/BashFAQ
- [21:08:24] <Aldaron> geirha: yeah, it's retarded because a retarded program needs to undestand it :)
- [21:08:53] <Aldaron> geirha: thanks for mentioning that, because I do get trouble when the month changes
- [21:08:53] <Riviera> Would of course be totally unretarded to have filenames that follow the limitations of a crappy shell.
- [21:09:04] <osse> !faq losing > Malsasa
- [21:09:05] <greybot> Malsasa: http://mywiki.wooledge.org/BashFAQ/088 -- How can I avoid losing any history lines?
- [21:09:07] <geirha> Malsasa: If you have bash 4.3, you can set them to -1 to get infinite history
- [21:09:15] --> Naib (~j@5751e858.skybroadband.com) has joined #bash
- [21:09:15] <-- Naib (~j@5751e858.skybroadband.com) has quit (Changing host)
- [21:09:15] --> Naib (~j@fu/hw/naib) has joined #bash
- [21:09:18] <-- Naib (~j@fu/hw/naib) has quit (Client Quit)
- [21:09:24] <geirha> on older versions, the highest number you can set is $((2**31 - 1))
- [21:09:42] <Malsasa> osse: I am going.
- [21:09:53] --> Naib (~j@5751e858.skybroadband.com) has joined #bash
- [21:09:53] <-- Naib (~j@5751e858.skybroadband.com) has quit (Changing host)
- [21:09:53] --> Naib (~j@fu/hw/naib) has joined #bash
- [21:10:18] <osse> $((2**32 - 1)) you mean?
- [21:10:41] <geirha> osse: I don't remember if it's signed or unsigned. Best go 31 to be on the safe side
- [21:10:58] <geirha> Malsasa: Also, I recommend changing HISTFILE as well. That avoids running bash --norc truncating it to 500 lines again
- [21:11:15] <geirha> HISTFILE=~/.bash_history.$HOSTNAME for instance
- [21:11:18] <osse> geirha: isn't the max 64 bits or something? Not for HISTFILE, but for $(())
- [21:11:32] <osse> # echo $((2**50))
- [21:11:33] <shbot> osse: 1125899906842624
- [21:11:56] <geirha> osse: yes, but HISTSIZE uses 32 bit int internally
- [21:12:07] <osse> ah
- [21:12:17] --> jasondotstar (~jasondots@2001:420:2280:1310:942e:7355:7ad4:7387) has joined #bash
- [21:12:50] <geirha> (( HISTFILESIZE = HISTSIZE = 2**31 - 1 ))
- [21:13:04] <-- darkbasic (~quassel@niko.linuxsystems.it) has quit (Quit: No Ping reply in 180 seconds.)
- [21:13:14] <Malsasa> geirha: thank you. But my HISTFILE was HISTFILE=~/.bash_history. Is it okay?
- [21:13:26] --> darkbasic (~quassel@niko.linuxsystems.it) has joined #bash
- [21:13:45] <geirha> Malsasa: that's the default, so it won't guard against bash --norc
- [21:14:00] <Savemech> osse: geirha:ty guys now itsworks really fine, now i can sleep well http://i.imgur.com/nCShuOl.png
- [21:14:12] <Savemech> Riviera:
- [21:14:38] <geirha> heh
- [21:14:44] <lhunath> Malsasa: by guard he means, if you ever start a default shell, it will wipe your history clean on exit.
- [21:14:57] --> elkorn (~elkorn@188.121.21.132) has joined #bash
- [21:14:59] --> somerandomnick12 (~a@gatek.thls.bbc.co.uk) has joined #bash
- [21:15:06] --> f-a (~f-a@nl1x.mullvad.net) has joined #bash
- [21:15:12] <-- Whiskey (whiskey@31.44.232.185) has quit (Ping timeout: 272 seconds)
- [21:15:13] <Malsasa> geirha: ooooow. Okay. I will change it.
- [21:15:30] <Malsasa> lhunath: thank you.
- [21:15:43] <f-a> so, due to me battling with bash I have not a file called --exclude=speccy . How to remove this?
- [21:15:53] --> jottr (~jottr@unaffiliated/jottr) has joined #bash
- [21:15:54] <geirha> well, wipe it down to the 500 line default
- [21:15:56] <-- koderok (~koderok@14.141.153.182) has quit (Quit: koderok)
- [21:16:14] <kerframil> f-a: rm -- <filename>
- [21:16:53] <f-a> thanks, that worked
- [21:17:03] <-- somerandomnick12 (~a@gatek.thls.bbc.co.uk) has quit (Client Quit)
- [21:17:29] <Malsasa> geirha: lhunath: osse: thank you. I have changed my bash history file name on .bashrc. I wanna back here soon after seeing the result.
- [21:17:47] <_val_> f-a: in case you're interested rm ./--exclude=speccy works too
- [21:18:06] <_val_> what the heck is a speccy?
- [21:18:11] <geirha> Malsasa: Don't forget to change the HISTSIZE and HISTFILESIZE values too
- [21:18:17] <f-a> a folder with, 'lo and behold, spectrum games
- [21:18:20] <f-a> a lot of them
- [21:18:27] <Malsasa> geirha: yes. I have specified big big size for them.
- [21:18:51] <geirha> Malsasa: make sure it does not exceed 2^31-1
- [21:18:57] <geirha> (which your original did)
- [21:19:05] <Malsasa> geirha: ow. Okay, okay. Now I understand.
- [21:19:38] --> aquinas_ (~aquinas_@unaffiliated/aquinas) has joined #bash
- [21:19:52] --> somerandomnick12 (~a@gatek.thls.bbc.co.uk) has joined #bash
- [21:20:54] --> lpax (~lpax@unaffiliated/lpax) has joined #bash
- [21:20:58] <Malsasa> geirha: OOT: is this channel have a log? I have googled just a few seconds ago.
- [21:21:00] <geirha> Malsasa: Oh and don't export variables like HISTCONTROL and PROMPT_COMMAND
- [21:21:16] --> fork (~fork@unaffiliated/milefork) has joined #bash
- [21:21:20] <geirha> no official logs
- [21:21:33] <-- kahen (~infenwe@0118200527.0.fullrate.dk) has quit (Ping timeout: 250 seconds)
- [21:22:00] <-- Aldaron (1000@nblzone-228-25.nblnetworks.fi) has left #bash
- [21:22:18] --> sqlnoob (~techgaun@113.199.170.206) has joined #bash
- [21:22:55] --> semeion (~semeion@unaffiliated/semeion) has joined #bash
- [21:23:05] --> oxhak (~OxHaK@ns330132.ip-37-59-37.eu) has joined #bash
- [21:23:47] --> fork|2 (~fork@unaffiliated/milefork) has joined #bash
- [21:24:06] <-- semeion (~semeion@unaffiliated/semeion) has quit (Client Quit)
- [21:25:24] --> dennisw (~dennis@128.42.164.155) has joined #bash
- [21:26:01] <-- fork (~fork@unaffiliated/milefork) has quit (Ping timeout: 245 seconds)
- [21:26:13] --> semeion (~semeion@unaffiliated/semeion) has joined #bash
- [21:27:51] --> ntz (~jdoe@static-84-42-228-122.net.upcbroadband.cz) has joined #bash
- [21:27:53] <ntz> hello
- [21:28:04] <-- f-a (~f-a@nl1x.mullvad.net) has left #bash ("bai")
- [21:28:21] <ntz> how am I supposed to check in bash if the perms are exactly 600 and owner $EUID ?
- [21:28:42] <ntz> i can realize many ugly ways with sed and so
- [21:28:50] <geirha> chmod 600 file && echo "permissions are right"
- [21:29:16] <ntz> I need to check if the file has already that perms
- [21:29:21] <-- TomyWork (~tomy@85.199.84.100) has quit (Ping timeout: 250 seconds)
- [21:29:23] <ntz> I don't want to touch that file ..
- [21:29:32] <Jetchisel> find?
- [21:29:42] <ntz> yeah, that's one of "nasty"ways
- [21:29:46] <capt_mercaptan> geirha: lol
- [21:29:54] <_val_> UsingFind has some xamples I think.
- [21:29:57] <ntz> but probably find is good
- [21:29:58] <capt_mercaptan> ntz: stat
- [21:29:59] <geirha> or stat(1) if your system has one
- [21:30:02] <_val_> s/xamples/examples.
- [21:30:08] --> Alex-SF (~Alex-SF@71.198.230.165) has joined #bash
- [21:30:29] --> ScriptFanix (vincent@Jedrik.DMZ.riquer.fr) has joined #bash
- [21:30:33] <-- PotatoGim^Home (~potatogim@211.115.242.166) has left #bash ("전 이만 갑니다.")
- [21:30:38] <geirha> The find would be something like [[ $(find file -perm 600 -print) ]]
- [21:30:44] <-- dreamon (~dreamon@unaffiliated/dreamon) has quit (Ping timeout: 240 seconds)
- [21:30:46] --> Nirgali42 (~dmart@64.132.167.18) has joined #bash
- [21:31:12] <geirha> silly find doesn't have a useful exit status, so you're left with testing output
- [21:31:12] <capt_mercaptan> find would be easier than stat
- [21:31:38] --> avostrik (~avostrik@178-16-155-142.obit.ru) has joined #bash
- [21:31:53] <capt_mercaptan> with stat, you'd get the permissions as a string (preferably in octal) and then have to string-compare with "0600"
- [21:32:04] <geirha> [[ $(find file -user "$EUID" -perm 600 -print) ]]
- [21:32:20] --> ggherdov (sid11402@gateway/web/irccloud.com/x-zeadfhvhwvzcpqpa) has joined #bash
- [21:32:28] <-- danemacmillan (~danemacmi@modemcable206.143-37-24.static.videotron.ca) has quit (Quit: WeeChat 1.0)
- [21:32:31] <ntz> Jetchisel: find /tmp/foo -perm 0600 -uid $EUID || something_else()
- [21:32:38] --> danemacmillan (~danemacmi@modemcable206.143-37-24.static.videotron.ca) has joined #bash
- [21:32:40] <ntz> yes, thanks .. that's all-in-one and good
- [21:32:57] --> magyar (~magyar@76.21.119.81) has joined #bash
- [21:33:00] <geirha> ntz: no. find doesn't have a useful exit status
- [21:33:02] <_val_> ntz: did you read the above thing? Find has no exit status.
- [21:33:05] <-- magyar (~magyar@76.21.119.81) has quit (Changing host)
- [21:33:05] --> magyar (~magyar@unaffiliated/magyar) has joined #bash
- [21:33:06] <-- Dary (~Dary@111.161.114.122) has quit (Ping timeout: 245 seconds)
- [21:33:10] <lhunath> -exec + can control find's exit code.
- [21:33:13] <ntz> it works
- [21:33:24] <geirha> and -user is posix, -uid is not
- [21:33:26] <ntz> i tested it with changing perms and owner ..but thanks
- [21:33:39] <osse> _val_: *no* exit status? So if you run find and then echo $? the shell SIGSEGVs? :O:O:O
- [21:33:47] --> PotatoGim^Laptop (~potatogim@211.115.242.166) has joined #bash
- [21:34:00] --> gargola (quassel@nat/hp/x-rrpumapugqbxtcbp) has joined #bash
- [21:34:34] <-- PotatoGim^Laptop (~potatogim@211.115.242.166) has left #bash
- [21:34:42] <Malsasa> geirha: okay, thank you. I have changed it.
- [21:35:01] <lhunath> and although I can't find a reference for it in the spec, all finds I have return 1 when the file doesn't exist.
- [21:35:04] <ntz> geirha: I know that -user is posix .. doing it on solaris
- [21:35:09] <capt_mercaptan> Can I use bash to randomize the instruction pointer's contents?
- [21:35:20] <geirha> ntz: Well, it won't work with GNU find at least
- [21:35:21] <ggherdov> hi. Is there anything to "decolorize" outputs ? I have some scripts that where written with a TTY in mind, and output fancy colors all around. Now I am running them headless-ly (automatic testing and the like) and I fetch their stdout. Those color codes are really disturbing.
- [21:35:21] <ggherdov> Any program I can pipe that stuff into, to get rid of colors?
- [21:35:24] <-- mdih (~dvillamer@112.210.72.68) has quit (Ping timeout: 260 seconds)
- [21:35:26] <ntz> it does
- [21:35:26] <lhunath> the best reference is that find Idontexist doesn't "All path operands were traversed successfully."
- [21:35:38] <ntz> i tested it right now on linux and solaris .. works reasonably
- [21:35:54] <capt_mercaptan> ggherdov: a sed script can be used to remove codes
- [21:36:07] <geirha> # touch file; chmod 666 file; find ./file -uid 0 -perm 600; echo $?
- [21:36:09] <shbot> geirha: 0
- [21:36:22] <geirha> ^ returns success even though the file has mode 666
- [21:36:34] <lhunath> ggherdov: TERM=dumb ?
- [21:36:48] <capt_mercaptan> ggherdov: you'd have to be more specific about what codes you're actually getting, like, are they ANSI escapes or terminal control code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement