我有一个如下所示的别名
alias testalias12569537329="echo it works"
我的问题是:如何通过连接两个字符串在shell脚本中调用testalias12569537329
?
x="testalias"
x+="12569537329" #timestamp
exec $x #command not found
我知道我可以在shell脚本中直接调用testalias12569537329。但我想操纵时间戳。谢谢!
答案 0 :(得分:1)
你可以这样做:
ToggleButton toggle1, toggle2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_act);
toggle1= (ToggleButton) findViewById(R.id.toggleButton1);
toggle2= (ToggleButton) findViewById(R.id.toggleButton2);
SharedPreferences spref = getSharedPreferences(null, 0);
if(spref.getBoolean("one", false)) {
toggle1.setChecked(true);
toggle2.setEnabled(false);
} else if(spref.getBoolean("two", false)) {
toggle2.setChecked(true);
toggle1.setEnabled(false);
}
toggle1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
toggle2.setEnabled(!isChecked);
getSharedPreferences(null, 0).edit()
.putBoolean("one", isChecked)
.apply();
startService(new Intent(MainActActivity.this,LockScreenService.class));
}
});
toggle2.setOnCheckedChangeListener(newCompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
toggle1.setEnabled(!isChecked);
getSharedPreferences(null, 0).edit()
.putBoolean("two", isChecked)
.apply();
startService(new Intent(MainActActivity.this,PinLockService.class)); }}); }}