command

How to run rename shell command in android app (rooted)

只谈情不闲聊 提交于 2019-12-04 15:35:40
I'm new to Android. I'm trying to run a shell command to rename a file in the system. I've got root access to it. The shell command: $ su # mount -o remount,rw /system # mv system/file.old system/file.new I have tried this but doesn't work: public void but1(View view) throws IOException{ Process process = Runtime.getRuntime().exec("su"); process = Runtime.getRuntime().exec("mount -o remount,rw /system"); process = Runtime.getRuntime().exec("mv /system/file.old system/file.new"); } You can run more then one command using the same process, by writing the commands in the process's OuputStream .

Linux head/tail with offset

只愿长相守 提交于 2019-12-04 15:28:50
问题 Is there a way in Linux to ask for the Head or Tail but with an additional offset of records to ignore. For example if the file example.lst contains the following: row01 row02 row03 row04 row05 And I use head -n3 example.lst I can get rows 1 - 3 but what if I want it to skip the first row and get rows 2 - 4? I ask because some commands have a header which may not be desirable within the search results. For example du -h ~ --max-depth 1 | sort -rh will return the directory size of all folders

Define an emacs command that calls another emacs command (preserving interactive stuff)

一世执手 提交于 2019-12-04 15:28:47
How can I define an emacs command X that does something and then calls another emacs command Y and also copying the interactive interface of the command Y too? I want to define an altenative version of query-replace with temporarilly toggled value of case-fold-search: (defun alt-query-replace (a b c d e) (interactive) (let ((case-fold-search (not case-fold-search)) (query-replace a b c d e))) This doesn't work. When I call alt-query-replace, it says "wrong number of arguments". I want the interactive interface of alt-query-replace to be the same as query-replace. Do I need to inspect the

Eclipse RCP: org.eclipse.ui.views.showView Parameters

*爱你&永不变心* 提交于 2019-12-04 14:52:53
I want to show a specific view in my RCP application using a command. Using showView opens a dialog to select view. Is there any way to do without selection dialog? I tried parameters but didn't help. Related part of plugin.xml is below. com.dbtek.hyperbola.views.contactsView is my view ID Tonny Madsen You need to add a command parameter with the id of the view to show. E.g. <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="menu:org.eclipse.ui.main.menu"> <menu id="window" label="Window"> <command commandId="org.eclipse.ui.views.showView" label="Show Progress" style="push

Programatically change icon for a eclipse RCP command

点点圈 提交于 2019-12-04 13:44:27
I have a menu drop down action in the coolbar. It has 3 sub items that form a radio group. I would like to change the icon shown in the coolbar when the user selects one of these options. I've googled and seen that I should look at: org.eclipse.ui.commands.ICommandService.refreshElements(String, Map) and org.eclipse.ui.commands.IElementUpdater Its probably the right thing to look at exception its not enough information. One or two small code snippets will be excellent. Thanks in advance. Ok basically if you don't want to use a "custom" control the what to do it is to have your handler (handler

Copying a Folder and renaming it using command prompt

你说的曾经没有我的故事 提交于 2019-12-04 13:12:04
I am trying to copy a folder and paste it in the same directory it was copied from. For example C:\Test is the main directory which consists of a folder ACDM, I would like to copy ACDM in the same directory and rename the new folder to ACDM1 which will have all the same files as ACDM has I would like to do it using command prompt I tried the following C:>Xcopy C:\Test C:\Test\ACDM1 /E /U Cannot perform a cyclic copy 0 File(s) copied which fails, not sure hoe to add REN command with XCOPY command. Need help ASAP as i would want to create a batch file which will create a copy of an existing

Spawn command not found

ⅰ亾dé卋堺 提交于 2019-12-04 12:15:48
I have an error trying to run a .sh file line 2: spawn: command not found ": no such file or directory bash.sh: line 3: expect: command not found bash.sh: line 4: send: command not found #!/usr/bin/expect -f spawn sftp -o IdentityFile=MyFile.ppk 500200243@XXX.XXX.XXX.XXX expect "XXX.XXX.XXX.XXX.gatewayEnter passphrase for key 'MyFile.ppk.ppk':" send "myPassword" Any idea why it happens? It works OK for me (error from sftp: ssh: Could not resolve hostname XXX.XXX.XXX.XXX: Name or service not known ), though the .sh extension for an expect ( tcl ) script is a little off-putting ;-) Often when

PowerShell Invoke-Expression with ampersand in the command string

心已入冬 提交于 2019-12-04 11:28:26
问题 I am trying to pass a variable with a string that contains an ampersand into Invoke-Expression, and it is telling me I have to put it in quotations and pass it as a string. I've tried multiple combinations of escaping and using a raw string and a string in a variable with combinations of "" and '' to no avail. How can I do it? Here's the code: $streamout_calmedia01 = ` "rtmp://75.126.42.216/livepkgr/calmedialive01?adbe-live-event=liveevent&adbe-record-mode=record" $streamcmd_calmedia01 = "C:

Uploading svn repository changes directly to a Production Server?

眉间皱痕 提交于 2019-12-04 11:12:23
Is it possible that i could upload my changes from the svn repository directly to my production server(2nd copy containing all the data as origional copy but for testing purposes)? I mean is there a way i could do it without EXPORT-> Then manually copy paste to production server... If yes, how can i do that? any pitfalls? Thanks One option (if you don't want to have the .svn subdirectories in your production site) is to do checkout to a different area on the disk, then update that periodically, and then rsync that across to the production site using a command such as rsync -a --exclude='*/.svn

Android Permissions on Runtime.getRuntime().exec()

☆樱花仙子☆ 提交于 2019-12-04 11:08:50
I have an App with the following permission on the manifest. My App is running on Android JB 4.1.2. UPDATE : I'm trying to run the App on JB, but it not works. It works on earlier API versions. <manifest xmlns...> <uses-permission android:name="android.permission.SET_DEBUG_APP"/> The problem is when I execute a command like this: Process proc = Runtime.getRuntime().exec("service call activity 42 s16 com.android.systemui"); BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(proc.getInputStream())); String line; while ((line = bufferedReader.readLine()) != null) { Log.e(