prompt

Bash Prompt with Last Exit Code

时光怂恿深爱的人放手 提交于 2019-11-27 06:39:53
So, I've been trying to customize by bash prompt so that it will look like [feralin@localhost ~]$ _ with colors. I managed to get constant colors (the same colors every time I see the prompt) but I want the username ('feralin') to appear red, instead of green, if the last command had a nonzero exit status. I came up with: \e[1;33m[$(if [[ $? == 0 ]]; then echo "\e[0;31m"; else echo "\e[0;32m"; fi)\u\e[m@\e[1;34m\h \e[0;35m\W\e[1;33m]$ \e[m However, from my observations, the $(if ...; fi) seems to be evaluated once, when the .bashrc is run, and the result is substituted forever after. This

What is that “total” in the very first line after ls -l? [closed]

守給你的承諾、 提交于 2019-11-27 06:24:01
What is the total in the output of ls -l ? $ ls -l /etc total 3344 -rw-r--r-- 1 root root 15276 Oct 5 2004 a2ps.cfg -rw-r--r-- 1 root root 2562 Oct 5 2004 a2ps-site.cfg drwxr-xr-x 4 root root 4096 Feb 2 2007 acpi -rw-r--r-- 1 root root 48 Feb 8 2008 adjtime drwxr-xr-x 4 root root 4096 Feb 2 2007 alchemist You can find the definition of that line in the ls documentation for your platform. For coreutils ls (the one found on a lot of Linux systems), the information can be found via info coreutils ls : For each directory that is listed, preface the files with a line `total BLOCKS', where BLOCKS is

bootbox.js官方文档

杀马特。学长 韩版系。学妹 提交于 2019-11-27 05:47:08
简介 Bootbox.js 是一个小型的JavaScript库,基于Bootstrap模态框开发,用于创建可编程的对话框。 不像原生的alert等对话框,所有的Bootstrap模态框生成的都是非阻塞事件。所以 在使用 confirm() 对话框时,请记住这一点,因为它不是本地确认对话框的替代。 任何取决于用户选择的代码都必须放在回调函数中。 alert alert是只有单个按钮的对话框,按ESC键或单击关闭按钮可关闭对话框。 bootbox.alert("Your message here…") message中可以放html语言,比如: bootbox.alert("Your message <b>here…</b>") 回调函数: bootbox.alert("Your message here…", function(){ /* your callback code */ }) options选项自定义对话框: bootbox.alert({ size: "small", title: "Your Title", message: "Your message here…", callback: function(){ /* your callback code */ } }) Confirm Confirm是具有确定和取消按钮的对话框,

How can the last command's wall time be put in the Bash prompt?

百般思念 提交于 2019-11-27 04:58:04
问题 Is there a way to embed the last command's elapsed wall time in a Bash prompt? I'm hoping for something that would look like this: [last: 0s][/my/dir]$ sleep 10 [last: 10s][/my/dir]$ Background I often run long data-crunching jobs and it's useful to know how long they've taken so I can estimate how long it will take for future jobs. For very regular tasks, I go ahead and record this information rigorously using appropriate logging techniques. For less-formal tasks, I'll just prepend the

JavaScript - multi-line textbox in prompt()?

谁说我不能喝 提交于 2019-11-27 04:50:21
问题 Is there anyway to make the textbox/input box in prompt multiline? 回答1: No, browsers only allow single-line input for prompt() . However, with a simple change to the jQuery Alert Dialogs library you could get multi-line input there. Take jquery.alerts.js , look for <input type="text" size="30" id="popup_prompt" /> and replace it by <textarea rows="5" cols="30" id="popup_prompt"></textarea> . That should do to have a multi-line input field show up when calling jPrompt() . Edit : As

Sum of two numbers with prompt

拈花ヽ惹草 提交于 2019-11-27 02:03:01
I've been trying to solve this problem for the last couple days: when I subtract, multiply or divide 2 numbers input through a prompt, everything works fine; but when I want to add them, I get the 2 numbers simply written together. Example: if I add 5 and 6, I get 56!! Here's the code I'm working with. var a = prompt("Enter first number"); var b = prompt("Enter second number"); alert(a + b); What am I doing wrong? Do I have to specify the value type? The function prompt returns a string and + is (unwisely, perhaps) used for both string concatenation and number addition. You do not "specify

Run SCRIPT from PL/SQL Block

老子叫甜甜 提交于 2019-11-26 23:27:11
问题 How to use "START SCRIPT" in pl/sql block ? I want to use something like this declare begin proc(para1,para2); execute immediate 'start prompt1' ; end; / Also I want to know , can i get a value from prompt1 into my PL/SQL block where am calling the script ? Because I need to use the value to perform some operations in the PL/SQL block. 回答1: It is 2012 2017. Scripts are a clunky and brittle hangover from the last millennium. Oracle has a fantastic range of functionality we can execute in PL

using the browser prompt to download a file

戏子无情 提交于 2019-11-26 22:22:54
问题 I have a php/mysql site in which I am trying to download a comma delimited file (CSV). The csv file I create contains comma delimited data (name, address, city, state). I create the csv file ok and place it in the site's /downloads directory. So far so good. I have been looking on line and the code to trigger the browser's download prompt that I see the most often is: $path = $_SERVER['DOCUMENT_ROOT']; $exportfile = "emailclientaddresses.csv"; $fullpath = "downloads/" . $exportfile; header(

List all environment variables from the command line

99封情书 提交于 2019-11-26 22:18:47
问题 Is it possible to list all environment variables from a Windows' command prompt? Something equivalent to PowerShell's gci env: (or ls env: or dir env: ). 回答1: Just do: SET You can also do SET prefix to see all variables with names starting with prefix . For example, if you want to read only derbydb from the environment variables, do the following: set derby ...and you will get the following: DERBY_HOME=c:\Users\amro-a\Desktop\db-derby-10.10.1.1-bin\db-derby-10.10.1.1-bin 回答2: Jon has the

Is there any way to create prompt with two input fields?

笑着哭i 提交于 2019-11-26 21:32:07
问题 Is there any way to create prompt in JavaScript with two input fields ? I tried that code, but it didn't help me : var a = prompt("A : ", ""); var b = prompt("B : ", ""); alert(a + "\n" + b); 回答1: This is not possible with an OS or native browser window popping up. You will have to create a custom overlay dialog. I would advise using a library like jQuery UI to do this. You can then customize whatever is in the popup. You can view a demo of the dialog here 回答2: Short of constructing your own